home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / patches / samba-1.003 / samba-1
Encoding:
Text File  |  1996-06-10  |  94.1 KB  |  3,130 lines

  1. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/docs/smb.conf.5 samba-1.9.16alpha10/docs/smb.conf.5
  2. --- samba-1.9.16alpha9/docs/smb.conf.5    Thu Jun  6 21:57:16 1996
  3. +++ samba-1.9.16alpha10/docs/smb.conf.5    Mon Jun 10 15:18:35 1996
  4. @@ -1419,6 +1419,28 @@
  5.  .B Example:
  6.       mangling char = ^
  7.  
  8. +.SS max disk size (G)
  9. +This option allows you to put an upper limit on the apparent size of
  10. +disks. If you set this option to 100 then all shares will appear to be
  11. +not larger than 100 MB in size.
  12. +
  13. +Note that this option does not limit the amount of data you can put on
  14. +the disk. In the above case you could still store much more than 100
  15. +MB on the disk, but if a client ever asks for the amount of free disk
  16. +space or the total disk size then the result will be bounded by the
  17. +amount specified in "max disk size".
  18. +
  19. +This option is primarily useful to work around bugs in some pieces of
  20. +software that can't handle very large disks, particularly disks over
  21. +1GB in size.
  22. +
  23. +A "max disk size" of 0 means no limit.
  24. +
  25. +.B Default:
  26. +    max disk size = 0
  27. +
  28. +.B Example:
  29. +    max disk size = 1000
  30.  .SS max log size (G)
  31.  
  32.  This option (an integer in kilobytes) specifies the max size the log
  33. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/Makefile samba-1.9.16alpha10/source/Makefile
  34. --- samba-1.9.16alpha9/source/Makefile    Fri Jun  7 15:36:52 1996
  35. +++ samba-1.9.16alpha10/source/Makefile    Mon Jun 10 15:18:47 1996
  36. @@ -497,7 +497,7 @@
  37.  
  38.  UTILOBJ1 = util.o system.o charset.o kanji.o fault.o smbencrypt.o charcnv.o
  39.  UTILOBJ2 = $(UTILOBJ1) md4.o loadparm.o params.o pcap.o username.o time.o
  40. -UTILOBJ = $(UTILOBJ2) interface.o 
  41. +UTILOBJ = $(UTILOBJ2) interface.o replace.o
  42.  PARAMOBJ = $(UTILOBJ) ufc.o smbpass.o access.o 
  43.  SMBDOBJ1 = $(PARAMOBJ) trans2.o message.o dir.o printing.o locking.o
  44.  SMBDOBJ2 = ipc.o reply.o mangle.o chgpasswd.o password.o quotas.o uid.o
  45. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/access.c samba-1.9.16alpha10/source/access.c
  46. --- samba-1.9.16alpha9/source/access.c    Sat May  4 17:50:23 1996
  47. +++ samba-1.9.16alpha10/source/access.c    Mon Jun 10 15:18:48 1996
  48. @@ -9,7 +9,6 @@
  49.  */
  50.  
  51.  #include "includes.h"
  52. -#include "loadparm.h"
  53.  
  54.  #define ALLOW_PURE_ADDRESSES
  55.  
  56. @@ -37,14 +36,11 @@
  57.  #define    FAIL        (-1)
  58.  
  59.  /* Forward declarations. */
  60. -BOOL allow_access(char *deny_list,char *allow_list,struct from_host *client);
  61.  static int list_match(char *list,char *item, int (*match_fn)());
  62.  static int client_match(char *tok,char *item);
  63.  static int string_match(char *tok,char *s);
  64.  static int masked_match(char *tok, char *slash, char *s);
  65.  static int matchname(char *remotehost,struct in_addr  addr);
  66. -BOOL fromhost(int sock,struct from_host *f);
  67. -
  68.  
  69.  /* Size of logical line buffer. */
  70.  #define    BUFLEN 2048
  71. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/chgpasswd.c samba-1.9.16alpha10/source/chgpasswd.c
  72. --- samba-1.9.16alpha9/source/chgpasswd.c    Sat May  4 17:50:23 1996
  73. +++ samba-1.9.16alpha10/source/chgpasswd.c    Mon Jun 10 15:18:48 1996
  74. @@ -27,7 +27,6 @@
  75.     */
  76.  
  77.  #include "includes.h"
  78. -#include "loadparm.h"
  79.  
  80.  extern int DEBUGLEVEL;
  81.  
  82. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/client.c samba-1.9.16alpha10/source/client.c
  83. --- samba-1.9.16alpha9/source/client.c    Thu Jun  6 21:57:20 1996
  84. +++ samba-1.9.16alpha10/source/client.c    Mon Jun 10 15:18:49 1996
  85. @@ -3694,10 +3694,6 @@
  86.  }
  87.  
  88.  
  89. -
  90. -
  91. -void cmd_help();
  92. -
  93.  /* This defines the commands supported by this client */
  94.  struct
  95.  {
  96. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/clitar.c samba-1.9.16alpha10/source/clitar.c
  97. --- samba-1.9.16alpha9/source/clitar.c    Wed Jun  5 01:16:26 1996
  98. +++ samba-1.9.16alpha10/source/clitar.c    Mon Jun 10 15:18:50 1996
  99. @@ -75,10 +75,7 @@
  100.  static void dotareof();
  101.  static void initarbuf();
  102.  static int do_setrattr();
  103. -void cmd_tar();
  104. -int process_tar();
  105. -char **toktocliplist();
  106. -int clipfind();
  107. +
  108.  /* restore functions */
  109.  static long readtarheader();
  110.  static long unoct();
  111. @@ -1486,7 +1483,7 @@
  112.        return;
  113.      }
  114.  
  115. -DEBUG(2, ("\nperm set %d %d\n", attra[ATTRSET], attra[ATTRRESET]));
  116. +  DEBUG(2, ("\nperm set %d %d\n", attra[ATTRSET], attra[ATTRRESET]));
  117.    (void) do_setrattr(fname, attra[ATTRSET], ATTRSET);
  118.    (void) do_setrattr(fname, attra[ATTRRESET], ATTRRESET);
  119.  }
  120. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/cvs.log samba-1.9.16alpha10/source/cvs.log
  121. --- samba-1.9.16alpha9/source/cvs.log    Sat Jun  8 15:41:17 1996
  122. +++ samba-1.9.16alpha10/source/cvs.log    Mon Jun 10 15:21:07 1996
  123. @@ -1459,3 +1459,118 @@
  124.  Log Message:
  125.  preparing for release of 1.9.16alpha9
  126.  
  127. +
  128. +****************************************
  129. +Date:    Monday June 10, 1996 @ 13:37
  130. +Author:    tridge
  131. +
  132. +Update of /data/cvs/samba/source
  133. +In directory arvidsjaur:/var/tmp/cvs-serv1310
  134. +
  135. +Modified Files:
  136. +    nameannounce.c namedb.c nameelect.c nameserv.h namework.c 
  137. +    nmbd.c nmbsync.c 
  138. +Log Message:
  139. +updates from Luke to rename "domains" more accurately to "subnets"
  140. +
  141. +
  142. +
  143. +****************************************
  144. +Date:    Monday June 10, 1996 @ 13:39
  145. +Author:    tridge
  146. +
  147. +Update of /data/cvs/samba/source
  148. +In directory arvidsjaur:/var/tmp/cvs-serv1374
  149. +
  150. +Modified Files:
  151. +    Makefile locking.c proto.h util.c 
  152. +Added Files:
  153. +    replace.c 
  154. +Log Message:
  155. +moved some more locking routines to locking.c, and moved replacement
  156. +routines for broken OSes from util.c to replace.c.
  157. +
  158. +
  159. +
  160. +
  161. +
  162. +****************************************
  163. +Date:    Monday June 10, 1996 @ 13:41
  164. +Author:    tridge
  165. +
  166. +Update of /data/cvs/samba/docs
  167. +In directory arvidsjaur:/var/tmp/cvs-serv1462
  168. +
  169. +Modified Files:
  170. +    smb.conf.5 
  171. +Log Message:
  172. +documented the "max disk size" option.
  173. +
  174. +I'm sure I've done this before, we must have lost some patches a while
  175. +ago?
  176. +
  177. +
  178. +
  179. +
  180. +
  181. +****************************************
  182. +Date:    Monday June 10, 1996 @ 14:38
  183. +Author:    tridge
  184. +
  185. +Update of /data/cvs/samba/source
  186. +In directory arvidsjaur:/var/tmp/cvs-serv1863
  187. +
  188. +Modified Files:
  189. +    access.c chgpasswd.c client.c clitar.c dir.c interface.c ipc.c 
  190. +    loadparm.c locking.c mangle.c message.c mkproto.awk 
  191. +    nameannounce.c namedb.c nameelect.c nameresp.c nameserv.c 
  192. +    namework.c nmbd.c nmblib.c nmbsync.c params.c password.c 
  193. +    pcap.c predict.c printing.c proto.h quotas.c reply.c server.c 
  194. +    smb.h smbencrypt.c smbpass.c status.c testparm.c testprns.c 
  195. +    trans2.c ufc.c uid.c username.c util.c 
  196. +Removed Files:
  197. +    loadparm.h localnet.h params.h pcap.h reply.h smbpass.h 
  198. +Log Message:
  199. +got rid of a lot of redundent header files as we now globally generate
  200. +prototypes automatically using "make proto". This is much less prone
  201. +to error than the old method of manually adding prototypes
  202. +
  203. +
  204. +
  205. +
  206. +
  207. +
  208. +****************************************
  209. +Date:    Monday June 10, 1996 @ 15:16
  210. +Author:    tridge
  211. +
  212. +Update of /data/cvs/samba/source
  213. +In directory arvidsjaur:/var/tmp/cvs-serv2785
  214. +
  215. +Modified Files:
  216. +    ipc.c password.c reply.c server.c smb.h trans2.c util.c 
  217. +Log Message:
  218. +a cleanup of the receive_smb() usage, adding timeouts in some places
  219. +
  220. +also added paranoid code in the main process() loop of smbd to detect
  221. +when smbd is looping uselessly. This should stop the "smbd is chewing
  222. +lots of cpu" reports
  223. +
  224. +
  225. +
  226. +
  227. +
  228. +
  229. +
  230. +****************************************
  231. +Date:    Monday June 10, 1996 @ 15:20
  232. +Author:    samba-bu
  233. +
  234. +Update of /data/cvs/samba/source
  235. +In directory arvidsjaur:/samba/samba-bugs/samba/source
  236. +
  237. +Modified Files:
  238. +    version.h 
  239. +Log Message:
  240. +preparing for release of 1.9.16alpha10
  241. +
  242. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/dir.c samba-1.9.16alpha10/source/dir.c
  243. --- samba-1.9.16alpha9/source/dir.c    Thu Jun  6 01:44:17 1996
  244. +++ samba-1.9.16alpha10/source/dir.c    Mon Jun 10 15:18:51 1996
  245. @@ -20,7 +20,6 @@
  246.  */
  247.  
  248.  #include "includes.h"
  249. -#include "loadparm.h"
  250.  
  251.  extern int DEBUGLEVEL;
  252.  extern connection_struct Connections[];
  253. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/interface.c samba-1.9.16alpha10/source/interface.c
  254. --- samba-1.9.16alpha9/source/interface.c    Sat Jun  8 15:37:52 1996
  255. +++ samba-1.9.16alpha10/source/interface.c    Mon Jun 10 15:18:51 1996
  256. @@ -20,7 +20,6 @@
  257.  */
  258.  
  259.  #include "includes.h"
  260. -#include "loadparm.h"
  261.  
  262.  extern int DEBUGLEVEL;
  263.  
  264. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/ipc.c samba-1.9.16alpha10/source/ipc.c
  265. --- samba-1.9.16alpha9/source/ipc.c    Thu Jun  6 21:57:21 1996
  266. +++ samba-1.9.16alpha10/source/ipc.c    Mon Jun 10 15:18:52 1996
  267. @@ -24,8 +24,6 @@
  268.     */
  269.  
  270.  #include "includes.h"
  271. -#include "loadparm.h"
  272. -#include "pcap.h"
  273.  
  274.  #ifdef CHECK_TYPES
  275.  #undef CHECK_TYPES
  276. @@ -2792,12 +2790,9 @@
  277.    while (pscnt < tpscnt || dscnt < tdscnt)
  278.      {
  279.        int pcnt,poff,dcnt,doff,pdisp,ddisp;
  280. -
  281. -      receive_smb(Client,inbuf, 0);
  282. -      show_msg(inbuf);
  283. -      
  284. -      /* Ensure this is still a trans packet (sanity check) */
  285. -      if(CVAL(inbuf, smb_com) != SMBtrans)
  286. +      
  287. +      if (!receive_smb(Client,inbuf, SMB_SECONDARY_WAIT*1000) ||
  288. +      CVAL(inbuf, smb_com) != SMBtrans)
  289.      {
  290.        DEBUG(2,("Invalid secondary trans2 packet\n"));
  291.        if (params) free(params);
  292. @@ -2805,6 +2800,8 @@
  293.        if (setup) free(setup);
  294.        return(ERROR(ERRSRV,ERRerror));
  295.      }
  296. +
  297. +      show_msg(inbuf);
  298.        
  299.        tpscnt = SVAL(inbuf,smb_vwv0);
  300.        tdscnt = SVAL(inbuf,smb_vwv1);
  301. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/loadparm.c samba-1.9.16alpha10/source/loadparm.c
  302. --- samba-1.9.16alpha9/source/loadparm.c    Fri Jun  7 15:36:53 1996
  303. +++ samba-1.9.16alpha10/source/loadparm.c    Mon Jun 10 15:18:53 1996
  304. @@ -49,10 +49,6 @@
  305.  
  306.  #include "includes.h"
  307.  
  308. -#include "params.h"
  309. -#include "loadparm.h"
  310. -#include "pcap.h"
  311. -
  312.  BOOL bLoaded = False;
  313.  
  314.  extern int DEBUGLEVEL;
  315. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/loadparm.h samba-1.9.16alpha10/source/loadparm.h
  316. --- samba-1.9.16alpha9/source/loadparm.h    Fri Jun  7 15:36:53 1996
  317. +++ samba-1.9.16alpha10/source/loadparm.h    Thu Jan  1 10:00:00 1970
  318. @@ -1,167 +0,0 @@
  319. -/* 
  320. -   Unix SMB/Netbios implementation.
  321. -   Version 1.9.
  322. -   Parameter loading functions
  323. -   Copyright (C) Karl Auer 1993, 1994
  324. -
  325. -   Extensively modified by Andrew Tridgell
  326. -   
  327. -   This program is free software; you can redistribute it and/or modify
  328. -   it under the terms of the GNU General Public License as published by
  329. -   the Free Software Foundation; either version 2 of the License, or
  330. -   (at your option) any later version.
  331. -   
  332. -   This program is distributed in the hope that it will be useful,
  333. -   but WITHOUT ANY WARRANTY; without even the implied warranty of
  334. -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  335. -   GNU General Public License for more details.
  336. -   
  337. -   You should have received a copy of the GNU General Public License
  338. -   along with this program; if not, write to the Free Software
  339. -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  340. -*/
  341. -
  342. -/*
  343. - *
  344. - * Prototypes etc for loadparm.c.
  345. - *
  346. - */
  347. -#ifndef _LOADPARM_H
  348. -#define _LOADPARM_H
  349. -
  350. -#include "smb.h"
  351. -
  352. -extern BOOL lp_file_list_changed(void);
  353. -extern void lp_killunused(BOOL (*snumused)(int ));
  354. -extern BOOL lp_loaded(void);
  355. -extern BOOL lp_snum_ok(int iService);
  356. -extern BOOL lp_manglednames(int iService);
  357. -extern char *lp_interfaces(void);
  358. -extern char *lp_passwordserver(void);
  359. -extern char *lp_passwd_program(void);
  360. -extern char *lp_passwd_chat(void);
  361. -extern char *lp_guestaccount(int iService);
  362. -extern char *lp_printcapname(void);
  363. -extern char *lp_lockdir(void);
  364. -extern char *lp_logfile(void);
  365. -extern char *lp_smbrun(void);
  366. -extern char *lp_configfile(void);
  367. -extern char *lp_smb_passwd_file(void);
  368. -extern char *lp_rootdir(void);
  369. -extern char *lp_defaultservice(void);
  370. -extern char *lp_serverstring(void);
  371. -extern char *lp_dfree_command(void);
  372. -extern char *lp_msg_command(void);
  373. -extern char *lp_workgroup(void);
  374. -extern char *lp_domain_controller(void);
  375. -extern char *lp_username_map(void);
  376. -extern char *lp_hosts_equiv(void);
  377. -extern char *lp_logon_script(void);
  378. -extern char *lp_wins_server(void);
  379. -extern char *lp_magicscript(int iService);
  380. -extern char *lp_magicoutput(int iService);
  381. -extern char *lp_mangled_map(int iService);
  382. -char *volume_label(int snum);
  383. -extern int  lp_os_level(void);
  384. -extern int  lp_max_ttl(void);
  385. -extern int  lp_max_log_size(void);
  386. -extern int  lp_maxxmit(void);
  387. -extern int  lp_maxmux(void);
  388. -extern int  lp_mangledstack(void);
  389. -extern BOOL lp_wins_support(void);
  390. -extern BOOL lp_wins_proxy(void);
  391. -extern BOOL lp_preferred_master(void);
  392. -extern BOOL lp_domain_master(void);
  393. -extern BOOL lp_domain_logons(void);
  394. -extern BOOL lp_getwdcache(void);
  395. -extern BOOL lp_use_rhosts(void);
  396. -extern BOOL lp_readprediction(void);
  397. -extern BOOL lp_readbmpx(void);
  398. -extern BOOL lp_readraw(void);
  399. -extern BOOL lp_writeraw(void);
  400. -extern BOOL lp_null_passwords(void);
  401. -extern BOOL lp_strip_dot(void);
  402. -extern BOOL lp_encrypted_passwords(void);
  403. -extern BOOL lp_syslog_only(void);
  404. -extern BOOL lp_browse_list(void);
  405. -extern int  lp_numservices(void);
  406. -extern int  lp_keepalive(void);
  407. -extern int  lp_passwordlevel(void);
  408. -extern int  lp_security(void);
  409. -extern int  lp_printing(void);
  410. -extern int  lp_maxdisksize(void);
  411. -extern int  lp_lpqcachetime(void);
  412. -extern int  lp_syslog(void);
  413. -extern int  lp_deadtime(void);
  414. -extern int  lp_readsize(void);
  415. -extern int  lp_debuglevel(void);
  416. -extern int  lp_maxprotocol(void);
  417. -extern int  lp_maxpacket(void);
  418. -extern char *lp_comment(int iService);
  419. -extern char *lp_preexec(int iService);
  420. -extern char *lp_postexec(int iService);
  421. -extern char *lp_rootpreexec(int iService);
  422. -extern char *lp_rootpostexec(int iService);
  423. -extern char *lp_servicename(int iService);
  424. -extern char *lp_pathname(int iService);
  425. -extern char *lp_username(int iService);
  426. -extern char *lp_invalid_users(int iService);
  427. -extern char *lp_valid_users(int iService);
  428. -extern char *lp_admin_users(int iService);
  429. -extern char *lp_printcommand(int iService);
  430. -extern char *lp_lpqcommand(int iService);
  431. -extern char *lp_lprmcommand(int iService);
  432. -extern char *lp_lppausecommand(int iService);
  433. -extern char *lp_lpresumecommand(int iService);
  434. -extern char *lp_printername(int iService);
  435. -extern char *lp_hostsallow(int iService);
  436. -extern char *lp_hostsdeny(int iService);
  437. -extern char *lp_dontdescend(int iService);
  438. -extern char *lp_force_user(int iService);
  439. -extern char *lp_force_group(int iService);
  440. -extern char *lp_readlist(int iService);
  441. -extern char *lp_writelist(int iService);
  442. -extern BOOL lp_alternate_permissions(int iService);
  443. -extern BOOL lp_revalidate(int iService);
  444. -extern BOOL lp_status(int iService);
  445. -extern BOOL lp_hide_dot_files(int iService);
  446. -extern BOOL lp_browseable(int iService);
  447. -extern BOOL lp_widelinks(int iService);
  448. -extern BOOL lp_syncalways(int iService);
  449. -extern BOOL lp_readonly(int iService);
  450. -extern BOOL lp_no_set_dir(int iService);
  451. -extern BOOL lp_guest_ok(int iService);
  452. -extern BOOL lp_guest_only(int iService);
  453. -extern BOOL lp_print_ok(int iService);
  454. -extern BOOL lp_postscript(int iService);
  455. -extern BOOL lp_map_hidden(int iService);
  456. -extern BOOL lp_map_archive(int iService);
  457. -extern BOOL lp_locking(int iService);
  458. -extern BOOL lp_strict_locking(int iService);
  459. -extern BOOL lp_share_modes(int iService);
  460. -extern BOOL lp_onlyuser(int iService);
  461. -extern BOOL lp_map_system(int iService);
  462. -extern BOOL lp_casesensitive(int iService);
  463. -extern BOOL lp_casemangle(int iService);
  464. -extern BOOL lp_preservecase(int iService);
  465. -extern BOOL lp_shortpreservecase(int iService);
  466. -extern BOOL lp_load(char *pszFname,BOOL global_only);
  467. -extern void lp_dump(void);
  468. -extern int  lp_servicenumber(char *pszServiceName);
  469. -extern BOOL lp_add_home(char *pszHomename, 
  470. -                        int iDefaultService, char *pszHomedir);
  471. -extern int lp_add_service(char *service, int iDefaultService);
  472. -extern BOOL lp_add_printer(char *pszPrintername, int iDefaultService);
  473. -extern BOOL lp_readonly(int iService);
  474. -extern int lp_create_mode(int iService);
  475. -extern int lp_minprintspace(int iService);
  476. -extern int lp_defaultcase(int iService);
  477. -extern char lp_magicchar(int iService);
  478. -extern int lp_max_connections(int iService);
  479. -extern BOOL lp_add_home(char *pservice,int ifrom,char *phome);
  480. -extern char *lp_string(char *s);
  481. -extern BOOL lp_delete_readonly(int iService);
  482. -char *my_workgroup(void);
  483. -
  484. -#endif
  485. -
  486. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/localnet.h samba-1.9.16alpha10/source/localnet.h
  487. --- samba-1.9.16alpha9/source/localnet.h    Thu Jun  6 21:57:21 1996
  488. +++ samba-1.9.16alpha10/source/localnet.h    Thu Jan  1 10:00:00 1970
  489. @@ -1,2 +0,0 @@
  490. -extern int ClientNMB;
  491. -extern int ClientDGRAM;
  492. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/locking.c samba-1.9.16alpha10/source/locking.c
  493. --- samba-1.9.16alpha9/source/locking.c    Sat May  4 17:50:24 1996
  494. +++ samba-1.9.16alpha10/source/locking.c    Mon Jun 10 15:18:54 1996
  495. @@ -20,12 +20,142 @@
  496.  */
  497.  
  498.  #include "includes.h"
  499. -#include "loadparm.h"
  500.  extern int DEBUGLEVEL;
  501.  extern connection_struct Connections[];
  502.  extern files_struct Files[];
  503.  
  504.  pstring share_del_pending="";
  505. +
  506. +
  507. +/****************************************************************************
  508. +routine to do file locking
  509. +****************************************************************************/
  510. +BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type)
  511. +{
  512. +#if HAVE_FCNTL_LOCK
  513. +  struct flock lock;
  514. +  int ret;
  515. +
  516. +#if 1
  517. +  uint32 mask = 0xC0000000;
  518. +
  519. +  /* make sure the count is reasonable, we might kill the lockd otherwise */
  520. +  count &= ~mask;
  521. +
  522. +  /* the offset is often strange - remove 2 of its bits if either of
  523. +     the top two bits are set. Shift the top ones by two bits. This
  524. +     still allows OLE2 apps to operate, but should stop lockd from
  525. +     dieing */
  526. +  if ((offset & mask) != 0)
  527. +    offset = (offset & ~mask) | ((offset & mask) >> 2);
  528. +#else
  529. +  unsigned long mask = ((unsigned)1<<31);
  530. +
  531. +  /* interpret negative counts as large numbers */
  532. +  if (count < 0)
  533. +    count &= ~mask;
  534. +
  535. +  /* no negative offsets */
  536. +  offset &= ~mask;
  537. +
  538. +  /* count + offset must be in range */
  539. +  while ((offset < 0 || (offset + count < 0)) && mask)
  540. +    {
  541. +      offset &= ~mask;
  542. +      mask = mask >> 1;
  543. +    }
  544. +#endif
  545. +
  546. +
  547. +  DEBUG(5,("fcntl_lock %d %d %d %d %d\n",fd,op,(int)offset,(int)count,type));
  548. +
  549. +  lock.l_type = type;
  550. +  lock.l_whence = SEEK_SET;
  551. +  lock.l_start = (int)offset;
  552. +  lock.l_len = (int)count;
  553. +  lock.l_pid = 0;
  554. +
  555. +  errno = 0;
  556. +
  557. +  ret = fcntl(fd,op,&lock);
  558. +
  559. +  if (errno != 0)
  560. +    DEBUG(3,("fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
  561. +
  562. +  /* a lock query */
  563. +  if (op == F_GETLK)
  564. +    {
  565. +      if ((ret != -1) &&
  566. +      (lock.l_type != F_UNLCK) && 
  567. +      (lock.l_pid != 0) && 
  568. +      (lock.l_pid != getpid()))
  569. +    {
  570. +      DEBUG(3,("fd %d is locked by pid %d\n",fd,lock.l_pid));
  571. +      return(True);
  572. +    }
  573. +
  574. +      /* it must be not locked or locked by me */
  575. +      return(False);
  576. +    }
  577. +
  578. +  /* a lock set or unset */
  579. +  if (ret == -1)
  580. +    {
  581. +      DEBUG(3,("lock failed at offset %d count %d op %d type %d (%s)\n",
  582. +           offset,count,op,type,strerror(errno)));
  583. +
  584. +      /* perhaps it doesn't support this sort of locking?? */
  585. +      if (errno == EINVAL)
  586. +    {
  587. +      DEBUG(3,("locking not supported? returning True\n"));
  588. +      return(True);
  589. +    }
  590. +
  591. +      return(False);
  592. +    }
  593. +
  594. +  /* everything went OK */
  595. +  DEBUG(5,("Lock call successful\n"));
  596. +
  597. +  return(True);
  598. +#else
  599. +  return(False);
  600. +#endif
  601. +}
  602. +
  603. +/*******************************************************************
  604. +lock a file - returning a open file descriptor or -1 on failure
  605. +The timeout is in seconds. 0 means no timeout
  606. +********************************************************************/
  607. +int file_lock(char *name,int timeout)
  608. +{  
  609. +  int fd = open(name,O_RDWR|O_CREAT,0666);
  610. +  time_t t=0;
  611. +  if (fd < 0) return(-1);
  612. +
  613. +#if HAVE_FCNTL_LOCK
  614. +  if (timeout) t = time(NULL);
  615. +  while (!timeout || (time(NULL)-t < timeout)) {
  616. +    if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)) return(fd);    
  617. +    msleep(LOCK_RETRY_TIMEOUT);
  618. +  }
  619. +  return(-1);
  620. +#else
  621. +  return(fd);
  622. +#endif
  623. +}
  624. +
  625. +/*******************************************************************
  626. +unlock a file locked by file_lock
  627. +********************************************************************/
  628. +void file_unlock(int fd)
  629. +{
  630. +  if (fd<0) return;
  631. +#if HAVE_FCNTL_LOCK
  632. +  fcntl_lock(fd,F_SETLK,0,1,F_UNLCK);
  633. +#endif
  634. +  close(fd);
  635. +}
  636.  
  637.  
  638.  /****************************************************************************
  639. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/mangle.c samba-1.9.16alpha10/source/mangle.c
  640. --- samba-1.9.16alpha9/source/mangle.c    Sun May  5 17:18:39 1996
  641. +++ samba-1.9.16alpha10/source/mangle.c    Mon Jun 10 15:18:54 1996
  642. @@ -20,7 +20,6 @@
  643.  */
  644.  
  645.  #include "includes.h"
  646. -#include "loadparm.h"
  647.  
  648.  extern int DEBUGLEVEL;
  649.  extern int case_default;
  650. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/message.c samba-1.9.16alpha10/source/message.c
  651. --- samba-1.9.16alpha9/source/message.c    Sat May  4 17:50:24 1996
  652. +++ samba-1.9.16alpha10/source/message.c    Mon Jun 10 15:18:54 1996
  653. @@ -25,7 +25,6 @@
  654.  
  655.  
  656.  #include "includes.h"
  657. -#include "loadparm.h"
  658.  
  659.  /* look in server.c for some explanation of these variables */
  660.  extern int DEBUGLEVEL;
  661. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/mkproto.awk samba-1.9.16alpha10/source/mkproto.awk
  662. --- samba-1.9.16alpha9/source/mkproto.awk    Tue Jun  4 16:53:22 1996
  663. +++ samba-1.9.16alpha10/source/mkproto.awk    Mon Jun 10 15:18:54 1996
  664. @@ -3,6 +3,8 @@
  665.  
  666.  BEGIN {
  667.    inheader=0;
  668. +  print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */"
  669. +  print ""
  670.  }
  671.  
  672.  {
  673. @@ -15,6 +17,43 @@
  674.      }
  675.      next;
  676.    }
  677. +}
  678. +
  679. +# we handle the loadparm.c fns separately
  680. +
  681. +/^FN_LOCAL_BOOL/ {
  682. +  split($0,a,"[,()]")
  683. +  printf "BOOL %s(int );\n", a[2]
  684. +}
  685. +
  686. +/^FN_LOCAL_STRING/ {
  687. +  split($0,a,"[,()]")
  688. +  printf "char *%s(int );\n", a[2]
  689. +}
  690. +
  691. +/^FN_LOCAL_INT/ {
  692. +  split($0,a,"[,()]")
  693. +  printf "int %s(int );\n", a[2]
  694. +}
  695. +
  696. +/^FN_LOCAL_CHAR/ {
  697. +  split($0,a,"[,()]")
  698. +  printf "char %s(int );\n", a[2]
  699. +}
  700. +
  701. +/^FN_GLOBAL_BOOL/ {
  702. +  split($0,a,"[,()]")
  703. +  printf "BOOL %s(void);\n", a[2]
  704. +}
  705. +
  706. +/^FN_GLOBAL_STRING/ {
  707. +  split($0,a,"[,()]")
  708. +  printf "char *%s(void);\n", a[2]
  709. +}
  710. +
  711. +/^FN_GLOBAL_INT/ {
  712. +  split($0,a,"[,()]")
  713. +  printf "int %s(void);\n", a[2]
  714.  }
  715.  
  716.  /^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ {
  717. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nameannounce.c samba-1.9.16alpha10/source/nameannounce.c
  718. --- samba-1.9.16alpha9/source/nameannounce.c    Sat Jun  8 15:37:52 1996
  719. +++ samba-1.9.16alpha10/source/nameannounce.c    Mon Jun 10 15:18:55 1996
  720. @@ -26,7 +26,6 @@
  721.  */
  722.  
  723.  #include "includes.h"
  724. -#include "loadparm.h"
  725.  
  726.  #define TEST_CODE
  727.  
  728. @@ -41,7 +40,7 @@
  729.  extern int ClientNMB;
  730.  
  731.  /* this is our domain/workgroup/server database */
  732. -extern struct domain_record *domainlist;
  733. +extern struct subnet_record *subnetlist;
  734.  
  735.  /* machine comment for host announcements */
  736.  extern  pstring ServerComment;
  737. @@ -119,7 +118,7 @@
  738.    time_t t = time(NULL);
  739.    pstring outbuf;
  740.    char *p;
  741. -  struct domain_record *d1;
  742. +  struct subnet_record *d1;
  743.    int tok;
  744.    
  745.    if (!lastrun) lastrun = t;
  746. @@ -128,10 +127,10 @@
  747.    
  748.    for (tok = 0; tok <= workgroup_count; tok++)
  749.      {
  750. -      for (d1 = domainlist; d1; d1 = d1->next)
  751. +      for (d1 = subnetlist; d1; d1 = d1->next)
  752.      {
  753.        struct work_record *work;
  754. -      struct domain_record *d;
  755. +      struct subnet_record *d;
  756.        
  757.        /* search for unique workgroup: only the name matters */
  758.        for (work = d1->workgrouplist;
  759. @@ -141,7 +140,7 @@
  760.        if (!work) continue;
  761.  
  762.        /* found one: announce it across all domains */
  763. -      for (d = domainlist; d; d = d->next)
  764. +      for (d = subnetlist; d; d = d->next)
  765.          {
  766.            int type=0;
  767.  
  768. @@ -192,17 +191,17 @@
  769.    char *commentp;
  770.    pstring comment;
  771.    char *my_name;
  772. -  struct domain_record *d;
  773. +  struct subnet_record *d;
  774.  
  775.    StrnCpy(comment, *ServerComment ? ServerComment : "NoComment", 43);
  776.  
  777.    my_name = *myname ? myname : "NoName";
  778.  
  779. -  for (d = domainlist; d; d = d->next)
  780. +  for (d = subnetlist; d; d = d->next)
  781.      {
  782.        struct work_record *work;
  783.        
  784. -      if (!ismybcast(d->bcast_ip))
  785. +      if (!d->my_interface)
  786.      continue;
  787.  
  788.        for (work = d->workgrouplist; work; work = work->next)
  789. @@ -229,7 +228,7 @@
  790.        
  791.        work->lastannounce_time = t;
  792.  
  793. -      if (!ismybcast(d->bcast_ip)) {
  794. +      if (!d->my_interface) {
  795.          stype &= ~(SV_TYPE_POTENTIAL_BROWSER | SV_TYPE_MASTER_BROWSER |
  796.                 SV_TYPE_DOMAIN_MASTER | SV_TYPE_BACKUP_BROWSER |
  797.                 SV_TYPE_DOMAIN_CTRL | SV_TYPE_DOMAIN_MEMBER);
  798. @@ -264,7 +263,7 @@
  799.            p = p+31;
  800.            p = skip_string(p,1);
  801.            
  802. -          if (ismybcast(d->bcast_ip))
  803. +          if (d->my_interface)
  804.          {
  805.            if (AM_MASTER(work))
  806.              {
  807. @@ -338,7 +337,7 @@
  808.    **************************************************************************/
  809.  void announce_master(void)
  810.  {
  811. -  struct domain_record *d;
  812. +  struct subnet_record *d;
  813.    static time_t last=0;
  814.    time_t t = time(NULL);
  815.    BOOL am_master = False; /* are we a master of some sort? :-) */
  816. @@ -348,7 +347,7 @@
  817.  
  818.    last = t;
  819.  
  820. -  for (d = domainlist; d; d = d->next)
  821. +  for (d = subnetlist; d; d = d->next)
  822.      {
  823.        struct work_record *work;
  824.        for (work = d->workgrouplist; work; work = work->next)
  825. @@ -362,7 +361,7 @@
  826.    
  827.    if (!am_master) return; /* only proceed if we are a master browser */
  828.    
  829. -  for (d = domainlist; d; d = d->next)
  830. +  for (d = subnetlist; d; d = d->next)
  831.      {
  832.        struct work_record *work;
  833.        for (work = d->workgrouplist; work; work = work->next)
  834. @@ -394,8 +393,8 @@
  835.              }
  836.                else
  837.              {
  838. -              struct domain_record *d2;
  839. -              for (d2 = domainlist; d2; d2 = d2->next)
  840. +              struct subnet_record *d2;
  841. +              for (d2 = subnetlist; d2; d2 = d2->next)
  842.                  {
  843.                    queue_netbios_packet(ClientNMB,NMB_QUERY,
  844.                             MASTER_SERVER_CHECK,
  845. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/namedb.c samba-1.9.16alpha10/source/namedb.c
  846. --- samba-1.9.16alpha9/source/namedb.c    Sat Jun  8 15:37:53 1996
  847. +++ samba-1.9.16alpha10/source/namedb.c    Mon Jun 10 15:18:56 1996
  848. @@ -27,7 +27,6 @@
  849.  
  850.  #include "includes.h"
  851.  #include "smb.h"
  852. -#include "loadparm.h"
  853.  
  854.  extern int ClientNMB;
  855.  extern int ClientDGRAM;
  856. @@ -44,7 +43,7 @@
  857.  struct browse_cache_record *browserlist = NULL;
  858.  
  859.  /* this is our domain/workgroup/server database */
  860. -struct domain_record *domainlist = NULL;
  861. +struct subnet_record *subnetlist = NULL;
  862.  
  863.  static BOOL updatedlists = True;
  864.  int  updatecount=0;
  865. @@ -61,7 +60,7 @@
  866.  /****************************************************************************
  867.    add a workgroup into the domain list
  868.    **************************************************************************/
  869. -static void add_workgroup(struct work_record *work, struct domain_record *d)
  870. +static void add_workgroup(struct work_record *work, struct subnet_record *d)
  871.  {
  872.    struct work_record *w2;
  873.  
  874. @@ -89,7 +88,7 @@
  875.  static struct work_record *make_workgroup(char *name)
  876.  {
  877.    struct work_record *work;
  878. -  struct domain_record *d;
  879. +  struct subnet_record *d;
  880.    int t = -1;
  881.    
  882.    if (!name || !name[0]) return NULL;
  883. @@ -108,7 +107,7 @@
  884.    
  885.    /* make sure all token representations of workgroups are unique */
  886.    
  887. -  for (d = domainlist; d && t == -1; d = d->next)
  888. +  for (d = subnetlist; d && t == -1; d = d->next)
  889.      {
  890.        struct work_record *w;
  891.        for (w = d->workgrouplist; w && t == -1; w = w->next)
  892. @@ -177,7 +176,7 @@
  893.  /*******************************************************************
  894.    remove workgroups
  895.    ******************************************************************/
  896. -struct work_record *remove_workgroup(struct domain_record *d, 
  897. +struct work_record *remove_workgroup(struct subnet_record *d, 
  898.                       struct work_record *work)
  899.  {
  900.    struct work_record *ret_work = NULL;
  901. @@ -204,19 +203,19 @@
  902.  /****************************************************************************
  903.    add a domain into the list
  904.    **************************************************************************/
  905. -static void add_domain(struct domain_record *d)
  906. +static void add_subnet(struct subnet_record *d)
  907.  {
  908. -  struct domain_record *d2;
  909. +  struct subnet_record *d2;
  910.  
  911. -  if (!domainlist)
  912. +  if (!subnetlist)
  913.    {
  914. -    domainlist = d;
  915. +    subnetlist = d;
  916.      d->prev = NULL;
  917.      d->next = NULL;
  918.      return;
  919.    }
  920.  
  921. -  for (d2 = domainlist; d2->next; d2 = d2->next);
  922. +  for (d2 = subnetlist; d2->next; d2 = d2->next);
  923.  
  924.    d2->next = d;
  925.    d->next = NULL;
  926. @@ -305,7 +304,7 @@
  927.    that it get created/added anyway. this allows us to force entries in
  928.    lmhosts file to be added.
  929.    **************************************************************************/
  930. -struct work_record *find_workgroupstruct(struct domain_record *d, 
  931. +struct work_record *find_workgroupstruct(struct subnet_record *d, 
  932.                       fstring name, BOOL add)
  933.  {
  934.    struct work_record *ret, *work;
  935. @@ -342,13 +341,13 @@
  936.      {
  937.        if (lp_preferred_master() &&
  938.        strequal(lp_workgroup(), name) &&
  939. -      ismybcast(d->bcast_ip))
  940. +      d->my_interface)
  941.      {
  942.        DEBUG(3, ("preferred master startup for %s\n", work->work_group));
  943.        work->needelection = True;
  944.        work->ElectionCriterion |= (1<<3);
  945.      }
  946. -      if (!ismybcast(d->bcast_ip))
  947. +      if (!d->my_interface)
  948.      {
  949.        work->needelection = False;
  950.      }
  951. @@ -359,21 +358,19 @@
  952.  }
  953.  
  954.  /****************************************************************************
  955. -  find a domain in the domainlist 
  956. +  find a domain in the subnetlist 
  957.    **************************************************************************/
  958. -struct domain_record *find_domain(struct in_addr source_ip)
  959. +struct subnet_record *find_domain(struct in_addr ip)
  960.  {   
  961. -  struct domain_record *d;
  962. +  struct subnet_record *d;
  963.    
  964.    /* search through domain list for broadcast/netmask that matches
  965.       the source ip address */
  966.    
  967. -  for (d = domainlist; d; d = d->next)
  968. +  for (d = subnetlist; d; d = d->next)
  969.      {
  970. -      if (same_net(source_ip, d->bcast_ip, d->mask_ip))
  971. -    {
  972. -      return(d);
  973. -    }
  974. +      if (same_net(ip, d->bcast_ip, d->mask_ip))
  975. +    return(d);
  976.      }
  977.    
  978.    return (NULL);
  979. @@ -385,9 +382,9 @@
  980.    **************************************************************************/
  981.  void dump_workgroups(void)
  982.  {
  983. -  struct domain_record *d;
  984. +  struct subnet_record *d;
  985.    
  986. -  for (d = domainlist; d; d = d->next)
  987. +  for (d = subnetlist; d; d = d->next)
  988.      {
  989.        if (d->workgrouplist)
  990.      {
  991. @@ -416,23 +413,25 @@
  992.  /****************************************************************************
  993.    create a domain entry
  994.    ****************************************************************************/
  995. -static struct domain_record *make_domain(struct in_addr ip, struct in_addr mask)
  996. +static struct subnet_record *make_subnet(struct in_addr bcast_ip,
  997. +                     struct in_addr mask)
  998.  {
  999. -  struct domain_record *d;
  1000. -  d = (struct domain_record *)malloc(sizeof(*d));
  1001. +  struct subnet_record *d;
  1002. +  d = (struct subnet_record *)malloc(sizeof(*d));
  1003.    
  1004.    if (!d) return(NULL);
  1005.    
  1006.    bzero((char *)d,sizeof(*d));
  1007.    
  1008. -  DEBUG(4, ("making domain %s ", inet_ntoa(ip)));
  1009. -  DEBUG(4, ("%s\n", inet_ntoa(mask)));
  1010. +  DEBUG(4,("making subnet %s ", inet_ntoa(bcast_ip)));
  1011. +  DEBUG(4,("%s\n", inet_ntoa(mask)));
  1012.    
  1013. -  d->bcast_ip = ip;
  1014. +  d->bcast_ip = bcast_ip;
  1015.    d->mask_ip  = mask;
  1016.    d->workgrouplist = NULL;
  1017. -  
  1018. -  add_domain(d);
  1019. +  d->my_interface = ismybcast(d->bcast_ip);
  1020. +
  1021. +  add_subnet(d);
  1022.    
  1023.    return d;
  1024.  }
  1025. @@ -441,11 +440,11 @@
  1026.    add a domain entry. creates a workgroup, if necessary, and adds the domain
  1027.    to the named a workgroup.
  1028.    ****************************************************************************/
  1029. -struct domain_record *add_domain_entry(struct in_addr source_ip, 
  1030. +struct subnet_record *add_subnet_entry(struct in_addr source_ip, 
  1031.                         struct in_addr source_mask,
  1032.                         char *name, BOOL add)
  1033.  {
  1034. -  struct domain_record *d;
  1035. +  struct subnet_record *d;
  1036.    struct in_addr ip;
  1037.    
  1038.    ip = ipgrp;
  1039. @@ -455,7 +454,7 @@
  1040.    
  1041.    /* add the domain into our domain database */
  1042.    if ((d = find_domain(source_ip)) ||
  1043. -      (d = make_domain(source_ip, source_mask)))
  1044. +      (d = make_subnet(source_ip, source_mask)))
  1045.      {
  1046.        struct work_record *w = find_workgroupstruct(d, name, add);
  1047.        
  1048. @@ -547,7 +546,7 @@
  1049.  /****************************************************************************
  1050.    add a server entry
  1051.    ****************************************************************************/
  1052. -struct server_record *add_server_entry(struct domain_record *d, 
  1053. +struct server_record *add_server_entry(struct subnet_record *d, 
  1054.                         struct work_record *work,
  1055.                         char *name,int servertype, 
  1056.                         int ttl,char *comment,
  1057. @@ -584,7 +583,7 @@
  1058.        bzero((char *)s,sizeof(*s));
  1059.      }
  1060.    
  1061. -  if (ismybcast(d->bcast_ip) &&
  1062. +  if (d->my_interface &&
  1063.        strequal(lp_workgroup(),work->work_group))
  1064.      {
  1065.        if (servertype)
  1066. @@ -633,7 +632,7 @@
  1067.    ******************************************************************/
  1068.  void write_browse_list(void)
  1069.  {
  1070. -  struct domain_record *d;
  1071. +  struct subnet_record *d;
  1072.    
  1073.    pstring fname,fnamenew;
  1074.    FILE *f;
  1075. @@ -661,7 +660,7 @@
  1076.        return;
  1077.      }
  1078.    
  1079. -  for (d = domainlist; d ; d = d->next)
  1080. +  for (d = subnetlist; d ; d = d->next)
  1081.      {
  1082.        struct work_record *work;
  1083.        for (work = d->workgrouplist; work ; work = work->next)
  1084. @@ -706,9 +705,9 @@
  1085.    ******************************************************************/
  1086.  void expire_servers(time_t t)
  1087.  {
  1088. -  struct domain_record *d;
  1089. +  struct subnet_record *d;
  1090.    
  1091. -  for (d = domainlist ; d ; d = d->next)
  1092. +  for (d = subnetlist ; d ; d = d->next)
  1093.      {
  1094.        struct work_record *work;
  1095.        
  1096. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nameelect.c samba-1.9.16alpha10/source/nameelect.c
  1097. --- samba-1.9.16alpha9/source/nameelect.c    Sat Jun  8 15:37:53 1996
  1098. +++ samba-1.9.16alpha10/source/nameelect.c    Mon Jun 10 15:18:56 1996
  1099. @@ -26,7 +26,6 @@
  1100.  */
  1101.  
  1102.  #include "includes.h"
  1103. -#include "loadparm.h"
  1104.  
  1105.  extern int ClientNMB;
  1106.  extern int ClientDGRAM;
  1107. @@ -47,7 +46,7 @@
  1108.  
  1109.  #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE"
  1110.  
  1111. -extern struct domain_record *domainlist;
  1112. +extern struct subnet_record *subnetlist;
  1113.  
  1114.  
  1115.  /*******************************************************************
  1116. @@ -57,7 +56,7 @@
  1117.  {
  1118.    static time_t lastrun=0;
  1119.    time_t t = time(NULL);
  1120. -  struct domain_record *d;
  1121. +  struct subnet_record *d;
  1122.  
  1123.    if (!lastrun) lastrun = t;
  1124.    if (t < lastrun + CHECK_TIME_MST_BROWSE * 60) 
  1125. @@ -67,7 +66,7 @@
  1126.  
  1127.    dump_workgroups();
  1128.  
  1129. -  for (d = domainlist; d; d = d->next)
  1130. +  for (d = subnetlist; d; d = d->next)
  1131.      {
  1132.        struct work_record *work;
  1133.  
  1134. @@ -92,13 +91,13 @@
  1135.    ******************************************************************/
  1136.  void browser_gone(char *work_name, struct in_addr ip)
  1137.  {
  1138. -  struct domain_record *d = find_domain(ip);
  1139. +  struct subnet_record *d = find_domain(ip);
  1140.    struct work_record *work = find_workgroupstruct(d, work_name, False);
  1141.  
  1142.    if (!work || !d) return;
  1143.  
  1144.    if (strequal(work->work_group, lp_workgroup()) &&
  1145. -      ismybcast(d->bcast_ip))
  1146. +      d->my_interface)
  1147.      {
  1148.  
  1149.        DEBUG(2,("Forcing election on %s %s\n",
  1150. @@ -125,7 +124,7 @@
  1151.  /****************************************************************************
  1152.    send an election packet
  1153.    **************************************************************************/
  1154. -void send_election(struct domain_record *d, char *group,uint32 criterion,
  1155. +void send_election(struct subnet_record *d, char *group,uint32 criterion,
  1156.             int timeup,char *name)
  1157.  {
  1158.    pstring outbuf;
  1159. @@ -157,7 +156,7 @@
  1160.  /*******************************************************************
  1161.    become the master browser
  1162.    ******************************************************************/
  1163. -static void become_master(struct domain_record *d, struct work_record *work)
  1164. +static void become_master(struct subnet_record *d, struct work_record *work)
  1165.  {
  1166.    uint32 domain_type = SV_TYPE_DOMAIN_ENUM | SV_TYPE_SERVER_UNIX | 0x00400000;
  1167.  
  1168. @@ -192,7 +191,7 @@
  1169.    add_server_entry(d,work,work->work_group,domain_type,0,myname,True);
  1170.    add_server_entry(d,work,myname,work->ServerType,0,ServerComment,True);
  1171.    
  1172. -  if (ismybcast(d->bcast_ip))
  1173. +  if (d->my_interface)
  1174.      {
  1175.        /* ask all servers on our local net to announce to us */
  1176.        announce_request(work, d->bcast_ip);
  1177. @@ -203,7 +202,7 @@
  1178.  /*******************************************************************
  1179.    unbecome the master browser
  1180.    ******************************************************************/
  1181. -void become_nonmaster(struct domain_record *d, struct work_record *work)
  1182. +void become_nonmaster(struct subnet_record *d, struct work_record *work)
  1183.  {
  1184.    DEBUG(2,("Becoming non-master for %s\n",work->work_group));
  1185.    
  1186. @@ -227,14 +226,14 @@
  1187.    time_t t = time(NULL);
  1188.    static time_t lastime = 0;
  1189.    
  1190. -  struct domain_record *d;
  1191. +  struct subnet_record *d;
  1192.    
  1193.    /* send election packets once a second */
  1194.    if (lastime && t-lastime <= 0) return;
  1195.    
  1196.    lastime = t;
  1197.    
  1198. -  for (d = domainlist; d; d = d->next)
  1199. +  for (d = subnetlist; d; d = d->next)
  1200.      {
  1201.        struct work_record *work;
  1202.        for (work = d->workgrouplist; work; work = work->next)
  1203. @@ -293,7 +292,7 @@
  1204.  {
  1205.    struct dgram_packet *dgram = &p->packet.dgram;
  1206.    struct in_addr ip = dgram->header.source_ip;
  1207. -  struct domain_record *d = find_domain(ip);
  1208. +  struct subnet_record *d = find_domain(ip);
  1209.    int version = CVAL(buf,0);
  1210.    uint32 criterion = IVAL(buf,1);
  1211.    int timeup = IVAL(buf,5)/1000;
  1212. @@ -313,7 +312,7 @@
  1213.      {
  1214.        if (listening_name(work, &dgram->dest_name) && 
  1215.        strequal(work->work_group, lp_workgroup()) &&
  1216. -      ismybcast(d->bcast_ip))
  1217. +      d->my_interface)
  1218.      {
  1219.        if (win_election(work, version,criterion,timeup,name))
  1220.          {
  1221. @@ -350,10 +349,10 @@
  1222.    ***************************************************************************/
  1223.  BOOL check_elections(void)
  1224.  {
  1225. -  struct domain_record *d;
  1226. +  struct subnet_record *d;
  1227.    BOOL run_any_election = False;
  1228.  
  1229. -  for (d = domainlist; d; d = d->next)
  1230. +  for (d = subnetlist; d; d = d->next)
  1231.      {
  1232.        struct work_record *work;
  1233.        for (work = d->workgrouplist; work; work = work->next)
  1234. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nameresp.c samba-1.9.16alpha10/source/nameresp.c
  1235. --- samba-1.9.16alpha9/source/nameresp.c    Sat Jun  8 15:37:53 1996
  1236. +++ samba-1.9.16alpha10/source/nameresp.c    Mon Jun 10 15:18:56 1996
  1237. @@ -21,7 +21,6 @@
  1238.  */
  1239.  
  1240.  #include "includes.h"
  1241. -#include "loadparm.h"
  1242.  
  1243.  extern int ClientNMB;
  1244.  extern int ClientDGRAM;
  1245. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nameserv.c samba-1.9.16alpha10/source/nameserv.c
  1246. --- samba-1.9.16alpha9/source/nameserv.c    Sat Jun  8 15:37:53 1996
  1247. +++ samba-1.9.16alpha10/source/nameserv.c    Mon Jun 10 15:18:56 1996
  1248. @@ -26,7 +26,6 @@
  1249.  */
  1250.  
  1251.  #include "includes.h"
  1252. -#include "loadparm.h"
  1253.  
  1254.  extern int ClientNMB;
  1255.  extern int ClientDGRAM;
  1256. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nameserv.h samba-1.9.16alpha10/source/nameserv.h
  1257. --- samba-1.9.16alpha9/source/nameserv.h    Sat Jun  8 15:37:53 1996
  1258. +++ samba-1.9.16alpha10/source/nameserv.h    Mon Jun 10 15:18:56 1996
  1259. @@ -144,17 +144,19 @@
  1260.    uint32  ElectionCriterion;
  1261.  };
  1262.  
  1263. -/* a domain structure. it contains a list of workgroups */
  1264. -struct domain_record
  1265. +/* a subnet structure. it contains a list of workgroups */
  1266. +struct subnet_record
  1267.  {
  1268. -  struct domain_record *next;
  1269. -  struct domain_record *prev;
  1270. +  struct subnet_record *next;
  1271. +  struct subnet_record *prev;
  1272.  
  1273.    struct work_record *workgrouplist;
  1274.  
  1275.    struct in_addr bcast_ip;
  1276.    struct in_addr mask_ip;
  1277.    struct in_addr myip;
  1278. +
  1279. +  BOOL my_interface;
  1280.  };
  1281.  
  1282.  /* a resource record */
  1283. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/namework.c samba-1.9.16alpha10/source/namework.c
  1284. --- samba-1.9.16alpha9/source/namework.c    Sat Jun  8 15:37:54 1996
  1285. +++ samba-1.9.16alpha10/source/namework.c    Mon Jun 10 15:18:56 1996
  1286. @@ -26,7 +26,6 @@
  1287.  */
  1288.  
  1289.  #include "includes.h"
  1290. -#include "loadparm.h"
  1291.  
  1292.  extern int ClientNMB;
  1293.  extern int ClientDGRAM;
  1294. @@ -50,7 +49,7 @@
  1295.  extern struct browse_cache_record *browserlist;
  1296.  
  1297.  /* this is our domain/workgroup/server database */
  1298. -extern struct domain_record *domainlist;
  1299. +extern struct subnet_record *subnetlist;
  1300.  
  1301.  /* machine comment for host announcements */
  1302.  extern  pstring ServerComment;
  1303. @@ -107,8 +106,8 @@
  1304.  **************************************************************************/
  1305.  void tell_become_backup(void)
  1306.  {
  1307. -  struct domain_record *d;
  1308. -  for (d = domainlist; d; d = d->next)
  1309. +  struct subnet_record *d;
  1310. +  for (d = subnetlist; d; d = d->next)
  1311.      {
  1312.        struct work_record *work;
  1313.        for (work = d->workgrouplist; work; work = work->next)
  1314. @@ -161,7 +160,7 @@
  1315.  **************************************************************************/
  1316.  static BOOL sync_browse_entry(struct browse_cache_record *b)
  1317.  {                     
  1318. -  struct domain_record *d;
  1319. +  struct subnet_record *d;
  1320.    struct work_record *work;
  1321.    /*
  1322.      if (!strequal(serv_name, b->name))
  1323. @@ -245,13 +244,13 @@
  1324.    if (type >= 0x1b && type <= 0x1e)
  1325.      {
  1326.        struct work_record *work;
  1327. -      struct domain_record *d;
  1328. +      struct subnet_record *d;
  1329.        
  1330.        if (!(d    = find_domain(ip))) return;
  1331.        if (!(work = find_workgroupstruct(d, name, False))) return;
  1332.        
  1333.        /* request the server to announce if on our subnet */
  1334. -      if (ismybcast(d->bcast_ip)) announce_request(work, ip);
  1335. +      if (d->my_interface) announce_request(work, ip);
  1336.        
  1337.        /* domain master type or master browser type */
  1338.        if (type == 0x1b || type == 0x1d)
  1339. @@ -280,7 +279,7 @@
  1340.    for (i=0;i<n;i++) {
  1341.      ip = iface_n_ip(i);
  1342.      if (!ip) return;
  1343. -    add_domain_entry(*iface_bcast(*ip),*iface_nmask(*ip),lp_workgroup(),True);
  1344. +    add_subnet_entry(*iface_bcast(*ip),*iface_nmask(*ip),lp_workgroup(),True);
  1345.    }
  1346.  }
  1347.  
  1348. @@ -292,7 +291,7 @@
  1349.                   int info_count, int token, int info,
  1350.                   int name_type, struct in_addr ip)
  1351.  {                     
  1352. -  struct domain_record *d;
  1353. +  struct subnet_record *d;
  1354.    char outbuf[1024];
  1355.    char *p, *countptr, *nameptr;
  1356.    int count = 0;
  1357. @@ -331,7 +330,7 @@
  1358.    
  1359.    nameptr = p;
  1360.    
  1361. -  for (d = domainlist; d; d = d->next)
  1362. +  for (d = subnetlist; d; d = d->next)
  1363.      {
  1364.        struct work_record *work;
  1365.        
  1366. @@ -465,7 +464,7 @@
  1367.  {
  1368.    struct dgram_packet *dgram = &p->packet.dgram;
  1369.    struct in_addr ip = dgram->header.source_ip;
  1370. -  struct domain_record *d = find_domain(ip); 
  1371. +  struct subnet_record *d = find_domain(ip); 
  1372.    int update_count = CVAL(buf,0);
  1373.    int ttl = IVAL(buf,1)/1000;
  1374.    char *name = buf+5;
  1375. @@ -546,8 +545,8 @@
  1376.  {
  1377.    struct dgram_packet *dgram = &p->packet.dgram;
  1378.    struct in_addr ip = dgram->header.source_ip;
  1379. -  struct domain_record *d = find_domain(ip);
  1380. -  struct domain_record *mydomain = find_domain(*iface_bcast(ip));
  1381. +  struct subnet_record *d = find_domain(ip);
  1382. +  struct subnet_record *mydomain = find_domain(*iface_bcast(ip));
  1383.    char *name = buf;
  1384.    struct work_record *work;
  1385.    name[15] = 0;
  1386. @@ -597,7 +596,7 @@
  1387.    for (buf1 = buf+5; *buf1 && count; buf1 = skip_string(buf1, 1), --count)
  1388.      {
  1389.        struct in_addr back_ip;
  1390. -      struct domain_record *d;
  1391. +      struct subnet_record *d;
  1392.        
  1393.        DEBUG(4,("Searching for backup browser %s at %s...\n",
  1394.             buf1, inet_ntoa(ip)));
  1395. @@ -616,8 +615,8 @@
  1396.        
  1397.        if ((d = find_domain(back_ip)))
  1398.      {
  1399. -      struct domain_record *d1;
  1400. -      for (d1 = domainlist; d1; d1 = d1->next)
  1401. +      struct subnet_record *d1;
  1402. +      for (d1 = subnetlist; d1; d1 = d1->next)
  1403.          {
  1404.            struct work_record *work;
  1405.            for (work = d1->workgrouplist; work; work = work->next)
  1406. @@ -651,7 +650,7 @@
  1407.  {
  1408.    struct dgram_packet *dgram = &p->packet.dgram;
  1409.    struct in_addr ip = dgram->header.source_ip;
  1410. -  struct domain_record *d; 
  1411. +  struct subnet_record *d; 
  1412.    struct work_record *work;
  1413.  
  1414.    int count = CVAL(buf,0);
  1415. @@ -669,7 +668,7 @@
  1416.      return;
  1417.    }
  1418.    
  1419. -  for (d = domainlist; d; d = d->next)
  1420. +  for (d = subnetlist; d; d = d->next)
  1421.      {
  1422.        for (work = d->workgrouplist; work; work = work->next)
  1423.      {
  1424. @@ -707,8 +706,8 @@
  1425.    /* stop being a master but still deal with being a backup browser */
  1426.    if (state & 0x1)
  1427.      {
  1428. -      struct domain_record *d;
  1429. -      for (d = domainlist; d; d = d->next)
  1430. +      struct subnet_record *d;
  1431. +      for (d = subnetlist; d; d = d->next)
  1432.      {
  1433.        struct work_record *work;
  1434.        for (work = d->workgrouplist; work; work = work->next)
  1435. @@ -724,8 +723,8 @@
  1436.    /* totally delete all servers and start afresh */
  1437.    if (state & 0x2)
  1438.      {
  1439. -      struct domain_record *d;
  1440. -      for (d = domainlist; d; d = d->next)
  1441. +      struct subnet_record *d;
  1442. +      for (d = subnetlist; d; d = d->next)
  1443.      {
  1444.        struct work_record *work;
  1445.        for (work=d->workgrouplist;work;work=remove_workgroup(d,work));
  1446. @@ -752,7 +751,7 @@
  1447.    struct dgram_packet *dgram = &p->packet.dgram;
  1448.    struct work_record *work;
  1449.    struct in_addr ip = dgram->header.source_ip;
  1450. -  struct domain_record *d = find_domain(ip);
  1451. +  struct subnet_record *d = find_domain(ip);
  1452.    int token = CVAL(buf,0);
  1453.    char *name = buf+1;
  1454.    
  1455. @@ -765,7 +764,7 @@
  1456.    
  1457.    if (!d) return;
  1458.    
  1459. -  if (!ismybcast(d->bcast_ip)) return;
  1460. +  if (!d->my_interface) return;
  1461.    
  1462.    for (work = d->workgrouplist; work; work = work->next)
  1463.      {
  1464. @@ -784,7 +783,7 @@
  1465.  {
  1466.    struct dgram_packet *dgram = &p->packet.dgram;
  1467.    struct in_addr ip = dgram->header.source_ip;
  1468. -  struct domain_record *d = find_domain(ip);
  1469. +  struct subnet_record *d = find_domain(ip);
  1470.    char *logname,*q;
  1471.    char *reply_name;
  1472.    BOOL add_slashes = False;
  1473. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nmbd.c samba-1.9.16alpha10/source/nmbd.c
  1474. --- samba-1.9.16alpha9/source/nmbd.c    Sat Jun  8 15:37:54 1996
  1475. +++ samba-1.9.16alpha10/source/nmbd.c    Mon Jun 10 15:18:56 1996
  1476. @@ -26,7 +26,6 @@
  1477.  */
  1478.  
  1479.  #include "includes.h"
  1480. -#include "loadparm.h"
  1481.  
  1482.  extern int DEBUGLEVEL;
  1483.  
  1484. @@ -287,7 +286,7 @@
  1485.        ipmask = *iface_nmask(ipaddr);
  1486.  
  1487.      if (group) {
  1488. -      add_domain_entry(ipaddr, ipmask, name, True);
  1489. +      add_subnet_entry(ipaddr, ipmask, name, True);
  1490.      } else {
  1491.        add_netbios_entry(name,0x20,NB_ACTIVE,0,source,ipaddr,True);
  1492.      }
  1493. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nmblib.c samba-1.9.16alpha10/source/nmblib.c
  1494. --- samba-1.9.16alpha9/source/nmblib.c    Thu Jun  6 21:57:22 1996
  1495. +++ samba-1.9.16alpha10/source/nmblib.c    Mon Jun 10 15:18:57 1996
  1496. @@ -21,7 +21,6 @@
  1497.  */
  1498.  
  1499.  #include "includes.h"
  1500. -#include "loadparm.h"
  1501.  
  1502.  extern int DEBUGLEVEL;
  1503.  
  1504. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/nmbsync.c samba-1.9.16alpha10/source/nmbsync.c
  1505. --- samba-1.9.16alpha9/source/nmbsync.c    Fri Jun  7 15:36:53 1996
  1506. +++ samba-1.9.16alpha10/source/nmbsync.c    Mon Jun 10 15:18:57 1996
  1507. @@ -21,7 +21,6 @@
  1508.  */
  1509.  
  1510.  #include "includes.h"
  1511. -#include "loadparm.h"
  1512.  
  1513.  extern int ClientNMB;
  1514.  extern int ClientDGRAM;
  1515. @@ -55,7 +54,7 @@
  1516.  /****************************************************************************
  1517.  adds information retrieved from a NetServerEnum call
  1518.  ****************************************************************************/
  1519. -static BOOL add_info(struct domain_record *d, struct work_record *work, int servertype)
  1520. +static BOOL add_info(struct subnet_record *d, struct work_record *work, int servertype)
  1521.  {
  1522.    char *rparam = NULL;
  1523.    char *rdata = NULL;
  1524. @@ -112,7 +111,7 @@
  1525.            /* creates workgroup on remote subnet */
  1526.            if ((w = find_workgroupstruct(d,sname, True)))
  1527.              {
  1528. -              if (ismybcast(d->bcast_ip))
  1529. +              if (d->my_interface)
  1530.              {
  1531.                announce_request(w, d->bcast_ip);
  1532.              }
  1533. @@ -141,7 +140,7 @@
  1534.  void sync_browse_lists(struct work_record *work, char *name, int nm_type,
  1535.                 struct in_addr ip)
  1536.  {
  1537. -  struct domain_record *d;
  1538. +  struct subnet_record *d;
  1539.    pid = getpid();
  1540.    uid = getuid();
  1541.    gid = getgid();
  1542. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/params.c samba-1.9.16alpha10/source/params.c
  1543. --- samba-1.9.16alpha9/source/params.c    Wed Jun  5 01:16:27 1996
  1544. +++ samba-1.9.16alpha10/source/params.c    Mon Jun 10 15:18:57 1996
  1545. @@ -57,7 +57,6 @@
  1546.  #include "includes.h"
  1547.  
  1548.  #include "smb.h"
  1549. -#include "params.h"
  1550.  
  1551.  /* local variable pointing to passed filename */
  1552.  static char *pszParmFile = NULL;
  1553. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/params.h samba-1.9.16alpha10/source/params.h
  1554. --- samba-1.9.16alpha9/source/params.h    Wed Jun  5 01:16:27 1996
  1555. +++ samba-1.9.16alpha10/source/params.h    Thu Jan  1 10:00:00 1970
  1556. @@ -1,40 +0,0 @@
  1557. -/* 
  1558. -   Unix SMB/Netbios implementation.
  1559. -   Version 1.9.
  1560. -   Parameter loading utilities
  1561. -   Copyright (C) Karl Auer 1993, 1994
  1562. -   
  1563. -   This program is free software; you can redistribute it and/or modify
  1564. -   it under the terms of the GNU General Public License as published by
  1565. -   the Free Software Foundation; either version 2 of the License, or
  1566. -   (at your option) any later version.
  1567. -   
  1568. -   This program is distributed in the hope that it will be useful,
  1569. -   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1570. -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1571. -   GNU General Public License for more details.
  1572. -   
  1573. -   You should have received a copy of the GNU General Public License
  1574. -   along with this program; if not, write to the Free Software
  1575. -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1576. -*/
  1577. -
  1578. -/**************************************************************************
  1579. -PARAMS.H
  1580. -
  1581. -Copyright (C) 1990, 1991, 1992 Karl Auer
  1582. -
  1583. -Prototypes and definitions for PARAMS.C.
  1584. -**************************************************************************/
  1585. -#ifndef _PARAMS_H
  1586. -#define _PARAMS_H
  1587. -
  1588. -#include <stdio.h>
  1589. -#include "smb.h"
  1590. -
  1591. -#define PM_NOFILE               1
  1592. -#define PM_NOFILENAME           2
  1593. -#define PM_FILEERROR            3
  1594. -
  1595. -#endif
  1596. -
  1597. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/password.c samba-1.9.16alpha10/source/password.c
  1598. --- samba-1.9.16alpha9/source/password.c    Thu Jun  6 21:57:23 1996
  1599. +++ samba-1.9.16alpha10/source/password.c    Mon Jun 10 15:18:58 1996
  1600. @@ -20,7 +20,6 @@
  1601.  */
  1602.  
  1603.  #include "includes.h"
  1604. -#include "loadparm.h"
  1605.  
  1606.  extern int DEBUGLEVEL;
  1607.  extern int Protocol;
  1608. @@ -1319,9 +1318,10 @@
  1609.    CVAL(outbuf,0) = 0x81;
  1610.  
  1611.    send_smb(password_client,outbuf);
  1612. -  receive_smb(password_client,inbuf,5000);
  1613. +  
  1614.   
  1615. -  if (CVAL(inbuf,0) != 0x82) {
  1616. +  if (!receive_smb(password_client,inbuf,5000) ||
  1617. +      CVAL(inbuf,0) != 0x82) {
  1618.      DEBUG(1,("%s rejected the session\n",pserver));
  1619.      close(password_client); password_client = -1;
  1620.      return(False);
  1621. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/pcap.c samba-1.9.16alpha10/source/pcap.c
  1622. --- samba-1.9.16alpha9/source/pcap.c    Sat May  4 17:50:24 1996
  1623. +++ samba-1.9.16alpha10/source/pcap.c    Mon Jun 10 15:18:58 1996
  1624. @@ -54,8 +54,6 @@
  1625.  #include "includes.h"
  1626.  
  1627.  #include "smb.h"
  1628. -#include "loadparm.h"
  1629. -#include "pcap.h"
  1630.  
  1631.  extern int DEBUGLEVEL;
  1632.  
  1633. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/pcap.h samba-1.9.16alpha10/source/pcap.h
  1634. --- samba-1.9.16alpha9/source/pcap.h    Sat May  4 17:50:24 1996
  1635. +++ samba-1.9.16alpha10/source/pcap.h    Thu Jan  1 10:00:00 1970
  1636. @@ -1,35 +0,0 @@
  1637. -/* 
  1638. -   Unix SMB/Netbios implementation.
  1639. -   Version 1.9.
  1640. -   printcap parsing
  1641. -   Copyright (C) Karl Auer 1993, 1994
  1642. -   
  1643. -   This program is free software; you can redistribute it and/or modify
  1644. -   it under the terms of the GNU General Public License as published by
  1645. -   the Free Software Foundation; either version 2 of the License, or
  1646. -   (at your option) any later version.
  1647. -   
  1648. -   This program is distributed in the hope that it will be useful,
  1649. -   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1650. -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1651. -   GNU General Public License for more details.
  1652. -   
  1653. -   You should have received a copy of the GNU General Public License
  1654. -   along with this program; if not, write to the Free Software
  1655. -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1656. -*/
  1657. -
  1658. -/*
  1659. - *
  1660. - * Prototypes etc for pcap.c.
  1661. - *
  1662. - */
  1663. -#ifndef _PCAP_H
  1664. -#define _PCAP_H
  1665. -
  1666. -#include "smb.h"
  1667. -
  1668. -extern BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname);
  1669. -extern void pcap_printer_fn(void (*fn)());
  1670. -
  1671. -#endif
  1672. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/predict.c samba-1.9.16alpha10/source/predict.c
  1673. --- samba-1.9.16alpha9/source/predict.c    Fri Jun  7 13:33:59 1996
  1674. +++ samba-1.9.16alpha10/source/predict.c    Mon Jun 10 15:18:59 1996
  1675. @@ -20,7 +20,6 @@
  1676.  */
  1677.  
  1678.  #include "includes.h"
  1679. -#include "loadparm.h"
  1680.  
  1681.  extern int DEBUGLEVEL;
  1682.  
  1683. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/printing.c samba-1.9.16alpha10/source/printing.c
  1684. --- samba-1.9.16alpha9/source/printing.c    Sat Jun  1 01:15:12 1996
  1685. +++ samba-1.9.16alpha10/source/printing.c    Mon Jun 10 15:18:59 1996
  1686. @@ -20,7 +20,6 @@
  1687.  */
  1688.  
  1689.  #include "includes.h"
  1690. -#include "loadparm.h"
  1691.  extern int DEBUGLEVEL;
  1692.  extern connection_struct Connections[];
  1693.  extern files_struct Files[];
  1694. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/proto.h samba-1.9.16alpha10/source/proto.h
  1695. --- samba-1.9.16alpha9/source/proto.h    Sat Jun  8 15:37:54 1996
  1696. +++ samba-1.9.16alpha10/source/proto.h    Mon Jun 10 15:18:59 1996
  1697. @@ -1,3 +1,4 @@
  1698. +/* This file is automatically generated with "make proto". DO NOT EDIT */
  1699.  BOOL check_access(int snum);
  1700.  BOOL allow_access(char *deny_list,char *allow_list,struct from_host *client);
  1701.  BOOL fromhost(int sock,struct from_host *f);
  1702. @@ -75,6 +76,123 @@
  1703.  int reply_trans(char *inbuf,char *outbuf);
  1704.  int interpret_coding_system(char *str, int def);
  1705.  char *lp_string(char *s);
  1706. +char *lp_logfile(void);
  1707. +char *lp_smbrun(void);
  1708. +char *lp_configfile(void);
  1709. +char *lp_smb_passwd_file(void);
  1710. +char *lp_serverstring(void);
  1711. +char *lp_printcapname(void);
  1712. +char *lp_lockdir(void);
  1713. +char *lp_rootdir(void);
  1714. +char *lp_defaultservice(void);
  1715. +char *lp_msg_command(void);
  1716. +char *lp_dfree_command(void);
  1717. +char *lp_hosts_equiv(void);
  1718. +char *lp_auto_services(void);
  1719. +char *lp_passwd_program(void);
  1720. +char *lp_passwd_chat(void);
  1721. +char *lp_passwordserver(void);
  1722. +char *lp_workgroup(void);
  1723. +char *lp_domain_controller(void);
  1724. +char *lp_username_map(void);
  1725. +char *lp_character_set(void);
  1726. +char *lp_logon_script(void);
  1727. +char *lp_wins_server(void);
  1728. +char *lp_interfaces(void);
  1729. +BOOL lp_wins_support(void);
  1730. +BOOL lp_wins_proxy(void);
  1731. +BOOL lp_domain_master(void);
  1732. +BOOL lp_domain_logons(void);
  1733. +BOOL lp_preferred_master(void);
  1734. +BOOL lp_load_printers(void);
  1735. +BOOL lp_use_rhosts(void);
  1736. +BOOL lp_getwdcache(void);
  1737. +BOOL lp_readprediction(void);
  1738. +BOOL lp_readbmpx(void);
  1739. +BOOL lp_readraw(void);
  1740. +BOOL lp_writeraw(void);
  1741. +BOOL lp_null_passwords(void);
  1742. +BOOL lp_strip_dot(void);
  1743. +BOOL lp_encrypted_passwords(void);
  1744. +BOOL lp_syslog_only(void);
  1745. +BOOL lp_browse_list(void);
  1746. +int lp_os_level(void);
  1747. +int lp_max_ttl(void);
  1748. +int lp_max_log_size(void);
  1749. +int lp_mangledstack(void);
  1750. +int lp_maxxmit(void);
  1751. +int lp_maxmux(void);
  1752. +int lp_maxpacket(void);
  1753. +int lp_keepalive(void);
  1754. +int lp_passwordlevel(void);
  1755. +int lp_readsize(void);
  1756. +int lp_deadtime(void);
  1757. +int lp_maxprotocol(void);
  1758. +int lp_security(void);
  1759. +int lp_printing(void);
  1760. +int lp_maxdisksize(void);
  1761. +int lp_lpqcachetime(void);
  1762. +int lp_syslog(void);
  1763. +char *lp_preexec(int );
  1764. +char *lp_postexec(int );
  1765. +char *lp_rootpreexec(int );
  1766. +char *lp_rootpostexec(int );
  1767. +char *lp_servicename(int );
  1768. +char *lp_pathname(int );
  1769. +char *lp_dontdescend(int );
  1770. +char *lp_username(int );
  1771. +char *lp_guestaccount(int );
  1772. +char *lp_invalid_users(int );
  1773. +char *lp_valid_users(int );
  1774. +char *lp_admin_users(int );
  1775. +char *lp_printcommand(int );
  1776. +char *lp_lpqcommand(int );
  1777. +char *lp_lprmcommand(int );
  1778. +char *lp_lppausecommand(int );
  1779. +char *lp_lpresumecommand(int );
  1780. +char *lp_printername(int );
  1781. +char *lp_hostsallow(int );
  1782. +char *lp_hostsdeny(int );
  1783. +char *lp_magicscript(int );
  1784. +char *lp_magicoutput(int );
  1785. +char *lp_comment(int );
  1786. +char *lp_force_user(int );
  1787. +char *lp_force_group(int );
  1788. +char *lp_readlist(int );
  1789. +char *lp_writelist(int );
  1790. +char *lp_volume(int );
  1791. +char *lp_mangled_map(int );
  1792. +BOOL lp_alternate_permissions(int );
  1793. +BOOL lp_revalidate(int );
  1794. +BOOL lp_casesensitive(int );
  1795. +BOOL lp_preservecase(int );
  1796. +BOOL lp_shortpreservecase(int );
  1797. +BOOL lp_casemangle(int );
  1798. +BOOL lp_status(int );
  1799. +BOOL lp_hide_dot_files(int );
  1800. +BOOL lp_browseable(int );
  1801. +BOOL lp_readonly(int );
  1802. +BOOL lp_no_set_dir(int );
  1803. +BOOL lp_guest_ok(int );
  1804. +BOOL lp_guest_only(int );
  1805. +BOOL lp_print_ok(int );
  1806. +BOOL lp_postscript(int );
  1807. +BOOL lp_map_hidden(int );
  1808. +BOOL lp_map_archive(int );
  1809. +BOOL lp_locking(int );
  1810. +BOOL lp_strict_locking(int );
  1811. +BOOL lp_share_modes(int );
  1812. +BOOL lp_onlyuser(int );
  1813. +BOOL lp_manglednames(int );
  1814. +BOOL lp_widelinks(int );
  1815. +BOOL lp_syncalways(int );
  1816. +BOOL lp_map_system(int );
  1817. +BOOL lp_delete_readonly(int );
  1818. +int lp_create_mode(int );
  1819. +int lp_max_connections(int );
  1820. +int lp_defaultcase(int );
  1821. +int lp_minprintspace(int );
  1822. +char lp_magicchar(int );
  1823.  BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir);
  1824.  int lp_add_service(char *pszService, int iDefaultService);
  1825.  BOOL lp_add_printer(char *pszPrintername, int iDefaultService);
  1826. @@ -88,6 +206,9 @@
  1827.  int lp_servicenumber(char *pszServiceName);
  1828.  char *my_workgroup(void);
  1829.  char *volume_label(int snum);
  1830. +BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
  1831. +int file_lock(char *name,int timeout);
  1832. +void file_unlock(int fd);
  1833.  BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset);
  1834.  BOOL do_lock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
  1835.  BOOL do_unlock(int fnum,int cnum,uint32 count,uint32 offset,int *eclass,uint32 *ecode);
  1836. @@ -115,19 +236,19 @@
  1837.  void announce_backup(void);
  1838.  void announce_host(void);
  1839.  void announce_master(void);
  1840. -struct work_record *remove_workgroup(struct domain_record *d, 
  1841. +struct work_record *remove_workgroup(struct subnet_record *d, 
  1842.                       struct work_record *work);
  1843.  void expire_browse_cache(time_t t);
  1844. -struct work_record *find_workgroupstruct(struct domain_record *d, 
  1845. +struct work_record *find_workgroupstruct(struct subnet_record *d, 
  1846.                       fstring name, BOOL add);
  1847. -struct domain_record *find_domain(struct in_addr source_ip);
  1848. +struct subnet_record *find_domain(struct in_addr ip);
  1849.  void dump_workgroups(void);
  1850. -struct domain_record *add_domain_entry(struct in_addr source_ip, 
  1851. +struct subnet_record *add_subnet_entry(struct in_addr source_ip, 
  1852.                         struct in_addr source_mask,
  1853.                         char *name, BOOL add);
  1854.  struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
  1855.                            time_t ttl, struct in_addr ip);
  1856. -struct server_record *add_server_entry(struct domain_record *d, 
  1857. +struct server_record *add_server_entry(struct subnet_record *d, 
  1858.                         struct work_record *work,
  1859.                         char *name,int servertype, 
  1860.                         int ttl,char *comment,
  1861. @@ -136,9 +257,9 @@
  1862.  void expire_servers(time_t t);
  1863.  void check_master_browser(void);
  1864.  void browser_gone(char *work_name, struct in_addr ip);
  1865. -void send_election(struct domain_record *d, char *group,uint32 criterion,
  1866. +void send_election(struct subnet_record *d, char *group,uint32 criterion,
  1867.             int timeup,char *name);
  1868. -void become_nonmaster(struct domain_record *d, struct work_record *work);
  1869. +void become_nonmaster(struct subnet_record *d, struct work_record *work);
  1870.  void run_elections(void);
  1871.  void process_election(struct packet_struct *p,char *buf);
  1872.  BOOL check_elections(void);
  1873. @@ -254,6 +375,13 @@
  1874.  BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
  1875.  BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
  1876.  BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
  1877. +char *Strstr(char *s, char *p);
  1878. +time_t Mktime(struct tm      *t);
  1879. +int InNetGr(char *group,char *host,char *user,char *dom);
  1880. +void *malloc_wrapped(int size,char *file,int line);
  1881. +void *realloc_wrapped(void *ptr,int size,char *file,int line);
  1882. +void free_wrapped(void *ptr,char *file,int line);
  1883. +void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
  1884.  int reply_special(char *inbuf,char *outbuf);
  1885.  int reply_tcon(char *inbuf,char *outbuf);
  1886.  int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize);
  1887. @@ -402,9 +530,6 @@
  1888.  BOOL user_in_list(char *user,char *list);
  1889.  void setup_logging(char *pname,BOOL interactive);
  1890.  void reopen_logs(void);
  1891. -BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
  1892. -int file_lock(char *name,int timeout);
  1893. -void file_unlock(int fd);
  1894.  BOOL is_a_socket(int fd);
  1895.  BOOL next_token(char **ptr,char *buff,char *sep);
  1896.  char **toktocliplist(int *ctok, char *sep);
  1897. @@ -509,13 +634,6 @@
  1898.  void BlockSignals(BOOL block);
  1899.  void ajt_panic(void);
  1900.  char *readdirname(void *p);
  1901. -void *malloc_wrapped(int size,char *file,int line);
  1902. -void *realloc_wrapped(void *ptr,int size,char *file,int line);
  1903. -void free_wrapped(void *ptr,char *file,int line);
  1904. -char *Strstr(char *s, char *p);
  1905. -time_t Mktime(struct tm      *t);
  1906. -int InNetGr(char *group,char *host,char *user,char *dom);
  1907. -void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
  1908.  int    VT_Check(char    *buffer);
  1909.  int VT_Start_utmp(void);
  1910.  int VT_Stop_utmp(void);
  1911. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/quotas.c samba-1.9.16alpha10/source/quotas.c
  1912. --- samba-1.9.16alpha9/source/quotas.c    Sat Jun  8 15:37:54 1996
  1913. +++ samba-1.9.16alpha10/source/quotas.c    Mon Jun 10 15:18:59 1996
  1914. @@ -273,7 +273,7 @@
  1915.      return(False) ;
  1916.    
  1917.    devno = sbuf.st_dev ;
  1918. -DEBUG(5,("disk_quotas: looking for path \"%s\" devno=%o\n", path,devno));
  1919. +  DEBUG(5,("disk_quotas: looking for path \"%s\" devno=%o\n", path,devno));
  1920.    if ( devno != devno_cached ) {
  1921.      devno_cached = devno ;
  1922.  #if defined(SUNOS5)
  1923. @@ -284,7 +284,8 @@
  1924.      while (getmntent(fd, &mnt) == 0) {
  1925.        if ( stat(mnt.mnt_mountp,&sbuf) == -1 )
  1926.      continue ;
  1927. -DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", mnt.mnt_mountp,sbuf.st_dev));
  1928. +      DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", 
  1929. +           mnt.mnt_mountp,sbuf.st_dev));
  1930.        if (sbuf.st_dev == devno) {
  1931.      found = True ;
  1932.      break ;
  1933. @@ -302,7 +303,8 @@
  1934.      while ((mnt = getmntent(fd)) != NULL) {
  1935.        if ( stat(mnt->mnt_dir,&sbuf) == -1 )
  1936.      continue ;
  1937. -DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", mnt->mnt_dir,sbuf.st_dev));
  1938. +      DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", 
  1939. +           mnt->mnt_dir,sbuf.st_dev));
  1940.        if (sbuf.st_dev == devno) {
  1941.      found = True ;
  1942.      break ;
  1943. @@ -324,7 +326,7 @@
  1944.    seteuid(0);
  1945.  
  1946.  #if defined(SUNOS5)
  1947. -DEBUG(5,("disk_quotas: looking for quotas file \"%s\"\n", name));
  1948. +  DEBUG(5,("disk_quotas: looking for quotas file \"%s\"\n", name));
  1949.    if((file=open(name, O_RDONLY))<0) {
  1950.      setuid(user_id);  /* Restore the original UID status */
  1951.      seteuid(euser_id);
  1952. @@ -336,7 +338,7 @@
  1953.    ret = ioctl(file, Q_QUOTACTL, &command);
  1954.    close(file);
  1955.  #else
  1956. -DEBUG(5,("disk_quotas: trying quotactl on device \"%s\"\n", name));
  1957. +  DEBUG(5,("disk_quotas: trying quotactl on device \"%s\"\n", name));
  1958.    ret = quotactl(Q_GETQUOTA, name, euser_id, &D);
  1959.  #endif
  1960.  
  1961. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/replace.c samba-1.9.16alpha10/source/replace.c
  1962. --- samba-1.9.16alpha9/source/replace.c    Thu Jan  1 10:00:00 1970
  1963. +++ samba-1.9.16alpha10/source/replace.c    Mon Jun 10 13:39:38 1996
  1964. @@ -0,0 +1,322 @@
  1965. +/* 
  1966. +   Unix SMB/Netbios implementation.
  1967. +   Version 1.9.
  1968. +   replacement routines for broken systems
  1969. +   Copyright (C) Andrew Tridgell 1992-1995
  1970. +   
  1971. +   This program is free software; you can redistribute it and/or modify
  1972. +   it under the terms of the GNU General Public License as published by
  1973. +   the Free Software Foundation; either version 2 of the License, or
  1974. +   (at your option) any later version.
  1975. +   
  1976. +   This program is distributed in the hope that it will be useful,
  1977. +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1978. +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1979. +   GNU General Public License for more details.
  1980. +   
  1981. +   You should have received a copy of the GNU General Public License
  1982. +   along with this program; if not, write to the Free Software
  1983. +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1984. +*/
  1985. +
  1986. +#include "includes.h"
  1987. +
  1988. + void replace_dummy(void) 
  1989. +{}
  1990. +
  1991. +#ifdef REPLACE_STRLEN
  1992. +/****************************************************************************
  1993. +a replacement strlen() that returns int for solaris
  1994. +****************************************************************************/
  1995. + int Strlen(char *s)
  1996. +{
  1997. +  int ret=0;
  1998. +  if (!s) return(0);
  1999. +  while (*s++) ret++;
  2000. +  return(ret);
  2001. +}
  2002. +#endif
  2003. +
  2004. +#ifdef NO_FTRUNCATE
  2005. + /*******************************************************************
  2006. +ftruncate for operating systems that don't have it
  2007. +********************************************************************/
  2008. + int ftruncate(int f,long l)
  2009. +{
  2010. +      struct  flock   fl;
  2011. +
  2012. +      fl.l_whence = 0;
  2013. +      fl.l_len = 0;
  2014. +      fl.l_start = l;
  2015. +      fl.l_type = F_WRLCK;
  2016. +      return fcntl(f, F_FREESP, &fl);
  2017. +}
  2018. +#endif
  2019. +
  2020. +
  2021. +#ifdef REPLACE_STRSTR
  2022. +/****************************************************************************
  2023. +Mips version of strstr doesn't seem to work correctly.
  2024. +There is a #define in includes.h to redirect calls to this function.
  2025. +****************************************************************************/
  2026. +char *Strstr(char *s, char *p)
  2027. +{
  2028. +    int len = strlen(p);
  2029. +
  2030. +    while ( *s != '\0' ) {
  2031. +        if ( strncmp(s, p, len) == 0 )
  2032. +        return s;
  2033. +        s++;
  2034. +    }
  2035. +
  2036. +    return NULL;
  2037. +}
  2038. +#endif /* REPLACE_STRSTR */
  2039. +
  2040. +
  2041. +#ifdef REPLACE_MKTIME
  2042. +/*******************************************************************
  2043. +a mktime() replacement for those who don't have it - contributed by 
  2044. +C.A. Lademann <cal@zls.com>
  2045. +********************************************************************/
  2046. +#define  MINUTE  60
  2047. +#define  HOUR    60*MINUTE
  2048. +#define  DAY             24*HOUR
  2049. +#define  YEAR    365*DAY
  2050. +time_t Mktime(struct tm      *t)
  2051. +{
  2052. +  struct tm       *u;
  2053. +  time_t  epoch = 0;
  2054. +  int             mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
  2055. +  y, m, i;
  2056. +
  2057. +  if(t->tm_year < 70)
  2058. +    return((time_t)-1);
  2059. +
  2060. +  epoch = (t->tm_year - 70) * YEAR + 
  2061. +    (t->tm_year / 4 - 70 / 4 - t->tm_year / 100) * DAY;
  2062. +
  2063. +  y = t->tm_year;
  2064. +  m = 0;
  2065. +
  2066. +  for(i = 0; i < t->tm_mon; i++) {
  2067. +    epoch += mon [m] * DAY;
  2068. +    if(m == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))
  2069. +      epoch += DAY;
  2070. +    
  2071. +    if(++m > 11) {
  2072. +      m = 0;
  2073. +      y++;
  2074. +    }
  2075. +  }
  2076. +
  2077. +  epoch += (t->tm_mday - 1) * DAY;
  2078. +  epoch += t->tm_hour * HOUR + t->tm_min * MINUTE + t->tm_sec;
  2079. +  
  2080. +  if((u = localtime(&epoch)) != NULL) {
  2081. +    t->tm_sec = u->tm_sec;
  2082. +    t->tm_min = u->tm_min;
  2083. +    t->tm_hour = u->tm_hour;
  2084. +    t->tm_mday = u->tm_mday;
  2085. +    t->tm_mon = u->tm_mon;
  2086. +    t->tm_year = u->tm_year;
  2087. +    t->tm_wday = u->tm_wday;
  2088. +    t->tm_yday = u->tm_yday;
  2089. +    t->tm_isdst = u->tm_isdst;
  2090. +#ifndef NO_TM_NAME
  2091. +    memcpy(t->tm_name, u->tm_name, LTZNMAX);
  2092. +#endif
  2093. +  }
  2094. +
  2095. +  return(epoch);
  2096. +}
  2097. +#endif /* REPLACE_MKTIME */
  2098. +
  2099. +
  2100. +
  2101. +#ifdef REPLACE_RENAME
  2102. +/* Rename a file. (from libiberty in GNU binutils)  */
  2103. + int rename (zfrom, zto)
  2104. +     const char *zfrom;
  2105. +     const char *zto;
  2106. +{
  2107. +  if (link (zfrom, zto) < 0)
  2108. +    {
  2109. +      if (errno != EEXIST)
  2110. +    return -1;
  2111. +      if (unlink (zto) < 0
  2112. +      || link (zfrom, zto) < 0)
  2113. +    return -1;
  2114. +    }
  2115. +  return unlink (zfrom);
  2116. +}
  2117. +#endif
  2118. +
  2119. +
  2120. +#ifdef REPLACE_INNETGR
  2121. +/*
  2122. + * Search for a match in a netgroup. This replaces it on broken systems.
  2123. + */
  2124. +int InNetGr(char *group,char *host,char *user,char *dom)
  2125. +{
  2126. +  char *hst, *usr, *dm;
  2127. +  
  2128. +  setnetgrent(group);
  2129. +  while (getnetgrent(&hst, &usr, &dm))
  2130. +    if (((host == 0) || (hst == 0) || !strcmp(host, hst)) &&
  2131. +    ((user == 0) || (usr == 0) || !strcmp(user, usr)) &&
  2132. +    ((dom == 0) || (dm == 0) || !strcmp(dom, dm))) {
  2133. +      endnetgrent();
  2134. +      return (1);
  2135. +    }
  2136. +  endnetgrent();
  2137. +  return (0);
  2138. +}
  2139. +#endif
  2140. +
  2141. +
  2142. +
  2143. +#ifdef NO_INITGROUPS
  2144. +#include <sys/types.h>
  2145. +#include <limits.h>
  2146. +#include <grp.h>
  2147. +
  2148. +#ifndef NULL
  2149. +#define NULL (void *)0
  2150. +#endif
  2151. +
  2152. +/****************************************************************************
  2153. + some systems don't have an initgroups call 
  2154. +****************************************************************************/
  2155. + int initgroups(char *name,gid_t id)
  2156. +{
  2157. +#ifdef NO_SETGROUPS
  2158. +  /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
  2159. +  return(0);
  2160. +#else
  2161. +  gid_t  grouplst[NGROUPS_MAX];
  2162. +  int    i,j;
  2163. +  struct group *g;
  2164. +  char   *gr;
  2165. +
  2166. +  grouplst[0] = id;
  2167. +  i = 1;
  2168. +  while (i < NGROUPS_MAX && 
  2169. +     ((g = (struct group *)getgrent()) != (struct group *)NULL)) 
  2170. +    {
  2171. +      if (g->gr_gid == id)
  2172. +    continue;
  2173. +      j = 0;
  2174. +      gr = g->gr_mem[0];
  2175. +      while (gr && (*gr != (char)NULL)) {
  2176. +    if (strcmp(name,gr) == 0) {
  2177. +      grouplst[i] = g->gr_gid;
  2178. +      i++;
  2179. +      gr = (char *)NULL;
  2180. +      break;
  2181. +    }
  2182. +    gr = g->gr_mem[++j];
  2183. +      }
  2184. +    }
  2185. +  endgrent();
  2186. +  return(setgroups(i,grouplst));
  2187. +#endif
  2188. +}
  2189. +#endif
  2190. +
  2191. +
  2192. +#if (defined(SecureWare) && defined(SCO))
  2193. +/* This is needed due to needing the nap() function but we don't want
  2194. +   to include the Xenix libraries since that will break other things...
  2195. +   BTW: system call # 0x0c28 is the same as calling nap() */
  2196. +long nap(long milliseconds) {
  2197. +  return syscall(0x0c28, milliseconds);
  2198. +}
  2199. +#endif
  2200. +
  2201. +
  2202. +
  2203. +#if WRAP_MALLOC
  2204. +
  2205. +/* undo the wrapping temporarily */
  2206. +#undef malloc
  2207. +#undef realloc
  2208. +#undef free
  2209. +
  2210. +/****************************************************************************
  2211. +wrapper for malloc() to catch memory errors
  2212. +****************************************************************************/
  2213. +void *malloc_wrapped(int size,char *file,int line)
  2214. +{
  2215. +#ifdef xx_old_malloc
  2216. +  void *res = xx_old_malloc(size);
  2217. +#else
  2218. +  void *res = malloc(size);
  2219. +#endif
  2220. +  DEBUG(3,("Malloc called from %s(%d) with size=%d gave ptr=0x%X\n",
  2221. +    file,line,
  2222. +    size,(unsigned int)res));
  2223. +  return(res);
  2224. +}
  2225. +
  2226. +/****************************************************************************
  2227. +wrapper for realloc() to catch memory errors
  2228. +****************************************************************************/
  2229. +void *realloc_wrapped(void *ptr,int size,char *file,int line)
  2230. +{
  2231. +#ifdef xx_old_realloc
  2232. +  void *res = xx_old_realloc(ptr,size);
  2233. +#else
  2234. +  void *res = realloc(ptr,size);
  2235. +#endif
  2236. +  DEBUG(3,("Realloc\n"));
  2237. +  DEBUG(3,("free called from %s(%d) with ptr=0x%X\n",
  2238. +    file,line,
  2239. +    (unsigned int)ptr));
  2240. +  DEBUG(3,("Malloc called from %s(%d) with size=%d gave ptr=0x%X\n",
  2241. +    file,line,
  2242. +    size,(unsigned int)res));
  2243. +  return(res);
  2244. +}
  2245. +
  2246. +/****************************************************************************
  2247. +wrapper for free() to catch memory errors
  2248. +****************************************************************************/
  2249. +void free_wrapped(void *ptr,char *file,int line)
  2250. +{
  2251. +#ifdef xx_old_free
  2252. +  xx_old_free(ptr);
  2253. +#else
  2254. +  free(ptr);
  2255. +#endif
  2256. +  DEBUG(3,("free called from %s(%d) with ptr=0x%X\n",
  2257. +    file,line,(unsigned int)ptr));
  2258. +  return;
  2259. +}
  2260. +
  2261. +/* and re-do the define for spots lower in this file */
  2262. +#define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
  2263. +#define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
  2264. +#define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
  2265. +
  2266. +#endif
  2267. +
  2268. +
  2269. +#if WRAP_MEMCPY
  2270. +#undef memcpy
  2271. +/*******************************************************************
  2272. +a wrapper around memcpy for diagnostic purposes
  2273. +********************************************************************/
  2274. +void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line)
  2275. +{
  2276. +  if (l>64 && (((int)d)%4) != (((int)s)%4))
  2277. +    DEBUG(4,("Misaligned memcpy(0x%X,0x%X,%d) at %s(%d)\n",d,s,l,fname,line));
  2278. +#ifdef xx_old_memcpy  
  2279. +  return(xx_old_memcpy(d,s,l));
  2280. +#else
  2281. +  return(memcpy(d,s,l));
  2282. +#endif
  2283. +}
  2284. +#define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
  2285. +#endif
  2286. +
  2287. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/reply.c samba-1.9.16alpha10/source/reply.c
  2288. --- samba-1.9.16alpha9/source/reply.c    Wed Jun  5 01:16:28 1996
  2289. +++ samba-1.9.16alpha10/source/reply.c    Mon Jun 10 15:19:00 1996
  2290. @@ -25,7 +25,6 @@
  2291.  
  2292.  
  2293.  #include "includes.h"
  2294. -#include "loadparm.h"
  2295.  #include "trans2.h"
  2296.  
  2297.  /* look in server.c for some explanation of these variables */
  2298. @@ -1591,7 +1590,7 @@
  2299.    send_smb(Client,outbuf);
  2300.    
  2301.    /* Now read the raw data into the buffer and write it */
  2302. -  if(read_smb_length(Client,inbuf,0) == -1) {
  2303. +  if (read_smb_length(Client,inbuf,SMB_SECONDARY_WAIT) == -1) {
  2304.      exit_server("secondary writebraw failed");
  2305.    }
  2306.    
  2307. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/reply.h samba-1.9.16alpha10/source/reply.h
  2308. --- samba-1.9.16alpha9/source/reply.h    Sat May  4 17:50:24 1996
  2309. +++ samba-1.9.16alpha10/source/reply.h    Thu Jan  1 10:00:00 1970
  2310. @@ -1,60 +0,0 @@
  2311. -int reply_special(char *inbuf,char *outbuf);
  2312. -int reply_corep(char *outbuf);
  2313. -int reply_coreplus(char *outbuf);
  2314. -int reply_nt1(char *outbuf);
  2315. -int reply_lanman1(char *outbuf);
  2316. -int reply_lanman2(char *outbuf);
  2317. -int reply_tcon(char *inbuf,char *outbuf);
  2318. -int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize);
  2319. -int reply_unknown(char *inbuf,char *outbuf);
  2320. -int reply_ioctl(char *inbuf,char *outbuf);
  2321. -int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize);
  2322. -int reply_chkpth(char *inbuf,char *outbuf);
  2323. -int reply_getatr(char *inbuf,char *outbuf);
  2324. -int reply_setatr(char *inbuf,char *outbuf);
  2325. -int reply_dskattr(char *inbuf,char *outbuf);
  2326. -int reply_search(char *inbuf,char *outbuf);
  2327. -int reply_fclose(char *inbuf,char *outbuf);
  2328. -int reply_open(char *inbuf,char *outbuf);
  2329. -int reply_open_and_X(char *inbuf,char *outbuf,int length,int bufsize);
  2330. -int reply_ulogoffX(char *inbuf,char *outbuf,int length,int bufsize);
  2331. -int reply_mknew(char *inbuf,char *outbuf);
  2332. -int reply_ctemp(char *inbuf,char *outbuf);
  2333. -int reply_unlink(char *inbuf,char *outbuf);
  2334. -int reply_readbraw(char *inbuf, char *outbuf);
  2335. -int reply_lockread(char *inbuf,char *outbuf);
  2336. -int reply_read(char *inbuf,char *outbuf);
  2337. -int reply_read_and_X(char *inbuf,char *outbuf,int length,int bufsize);
  2338. -int reply_writebraw(char *inbuf,char *outbuf);
  2339. -int reply_writeunlock(char *inbuf,char *outbuf);
  2340. -int reply_write(char *inbuf,char *outbuf,int dum1,int dum2);
  2341. -int reply_write_and_X(char *inbuf,char *outbuf,int length,int bufsize);
  2342. -int reply_lseek(char *inbuf,char *outbuf);
  2343. -int reply_flush(char *inbuf,char *outbuf);
  2344. -int reply_exit(char *inbuf,char *outbuf);
  2345. -int reply_close(char *inbuf,char *outbuf);
  2346. -int reply_writeclose(char *inbuf,char *outbuf);
  2347. -int reply_lock(char *inbuf,char *outbuf);
  2348. -int reply_unlock(char *inbuf,char *outbuf);
  2349. -int reply_tdis(char *inbuf,char *outbuf);
  2350. -int reply_echo(char *inbuf,char *outbuf);
  2351. -int reply_printopen(char *inbuf,char *outbuf);
  2352. -int reply_printclose(char *inbuf,char *outbuf);
  2353. -int reply_printqueue(char *inbuf,char *outbuf);
  2354. -int reply_printwrite(char *inbuf,char *outbuf);
  2355. -int reply_mkdir(char *inbuf,char *outbuf);
  2356. -int reply_rmdir(char *inbuf,char *outbuf);
  2357. -int reply_mv(char *inbuf,char *outbuf);
  2358. -int reply_copy(char *inbuf,char *outbuf);
  2359. -int reply_setdir(char *inbuf,char *outbuf);
  2360. -int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize);
  2361. -int reply_readbmpx(char *inbuf,char *outbuf,int length,int bufsize);
  2362. -int reply_writebmpx(char *inbuf,char *outbuf);
  2363. -int reply_setattrE(char *inbuf,char *outbuf);
  2364. -int reply_getattrE(char *inbuf,char *outbuf);
  2365. -int reply_writebs(char *inbuf,char *outbuf);
  2366. -int reply_sends(char *inbuf,char *outbuf);
  2367. -int reply_sendstrt(char *inbuf,char *outbuf);
  2368. -int reply_sendend(char *inbuf,char *outbuf);
  2369. -int reply_sendtxt(char *inbuf,char *outbuf);
  2370. -int reply_transs2(char *inbuf,char *outbuf,int length,int bufsize);
  2371. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/server.c samba-1.9.16alpha10/source/server.c
  2372. --- samba-1.9.16alpha9/source/server.c    Thu Jun  6 21:57:24 1996
  2373. +++ samba-1.9.16alpha10/source/server.c    Mon Jun 10 15:19:01 1996
  2374. @@ -20,10 +20,7 @@
  2375.  */
  2376.  
  2377.  #include "includes.h"
  2378. -#include "loadparm.h"
  2379. -#include "pcap.h"
  2380.  #include "trans2.h"
  2381. -#include "reply.h"
  2382.  
  2383.  pstring servicesf = CONFIGFILE;
  2384.  extern pstring debugf;
  2385. @@ -3447,6 +3444,27 @@
  2386.        }
  2387.  
  2388.        t = time(NULL);
  2389. +
  2390. +      {
  2391. +        /* the following bit of code was added to combat smbd
  2392. +               looping chewing lots of CPU time. It should never
  2393. +               actually be needed, but it seems that some systems
  2394. +               don't set error correctly, which is used to distinguish
  2395. +               a select() timeout from a read error 
  2396. +           
  2397. +           we exit if receive_smb() returns false 3 times in one second. 
  2398. +           */
  2399. +        static int error_count=0;
  2400. +        static time_t error_time=0;
  2401. +        if (error_count==0) {
  2402. +          error_time = t;
  2403. +        } else if (error_time != t) {
  2404. +          error_count = 0;
  2405. +        } else if (error_count++ > 2) {
  2406. +          exit_server("looping in process()\n");
  2407. +        }
  2408. +      }
  2409. +
  2410.  
  2411.        /* become root again if waiting */
  2412.        unbecome_user();
  2413. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/smb.h samba-1.9.16alpha10/source/smb.h
  2414. --- samba-1.9.16alpha9/source/smb.h    Wed Jun  5 01:16:29 1996
  2415. +++ samba-1.9.16alpha10/source/smb.h    Mon Jun 10 15:19:02 1996
  2416. @@ -99,6 +99,9 @@
  2417.  #define DEFAULT_PIPE_TIMEOUT 10000000 /* Ten seconds */
  2418.  #endif
  2419.  
  2420. +/* how long to wait for secondary SMB packets (seconds) */
  2421. +#define SMB_SECONDARY_WAIT 30
  2422. +
  2423.  /* debugging code */
  2424.  #ifndef SYSLOG
  2425.  #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0)
  2426. @@ -232,6 +235,15 @@
  2427.  typedef char pstring[1024];
  2428.  typedef char fstring[128];
  2429.  typedef fstring string;
  2430. +
  2431. +
  2432. +struct smb_passwd {
  2433. +    int smb_userid;
  2434. +    char *smb_name;
  2435. +    unsigned char *smb_passwd; /* Null if no password */
  2436. +    unsigned char *smb_nt_passwd; /* Null if no password */
  2437. +    /* Other fields / flags may be added later */
  2438. +};
  2439.  
  2440.  
  2441.  struct current_user {
  2442. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/smbencrypt.c samba-1.9.16alpha10/source/smbencrypt.c
  2443. --- samba-1.9.16alpha9/source/smbencrypt.c    Wed Jun  5 01:16:29 1996
  2444. +++ samba-1.9.16alpha10/source/smbencrypt.c    Mon Jun 10 15:19:02 1996
  2445. @@ -22,7 +22,6 @@
  2446.  */
  2447.  
  2448.  #include "includes.h"
  2449. -#include "loadparm.h"
  2450.  #include "des.h"
  2451.  #include "md4.h"
  2452.  
  2453. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/smbpass.c samba-1.9.16alpha10/source/smbpass.c
  2454. --- samba-1.9.16alpha9/source/smbpass.c    Wed Jun  5 01:16:29 1996
  2455. +++ samba-1.9.16alpha10/source/smbpass.c    Mon Jun 10 15:19:02 1996
  2456. @@ -19,7 +19,6 @@
  2457.   */
  2458.  
  2459.  #include "includes.h"
  2460. -#include "loadparm.h"
  2461.  
  2462.  extern int      DEBUGLEVEL;
  2463.  
  2464. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/smbpass.h samba-1.9.16alpha10/source/smbpass.h
  2465. --- samba-1.9.16alpha9/source/smbpass.h    Sat May  4 17:50:25 1996
  2466. +++ samba-1.9.16alpha10/source/smbpass.h    Thu Jan  1 10:00:00 1970
  2467. @@ -1,50 +0,0 @@
  2468. -#ifndef _SMBPASS_H_
  2469. -#define _SMBPASS_H_
  2470. -/* 
  2471. -   Unix SMB/Netbios implementation.
  2472. -   Version 1.9.
  2473. -   SMB parameters and setup
  2474. -   Copyright (C) Jeremy Allison 1995
  2475. -   
  2476. -   This program is free software; you can redistribute it and/or modify
  2477. -   it under the terms of the GNU General Public License as published by
  2478. -   the Free Software Foundation; either version 2 of the License, or
  2479. -   (at your option) any later version.
  2480. -   
  2481. -   This program is distributed in the hope that it will be useful,
  2482. -   but WITHOUT ANY WARRANTY; without even the implied warranty of
  2483. -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2484. -   GNU General Public License for more details.
  2485. -   
  2486. -   You should have received a copy of the GNU General Public License
  2487. -   along with this program; if not, write to the Free Software
  2488. -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2489. -*/
  2490. -
  2491. -struct smb_passwd {
  2492. -    int smb_userid;
  2493. -    char *smb_name;
  2494. -    unsigned char *smb_passwd; /* Null if no password */
  2495. -    unsigned char *smb_nt_passwd; /* Null if no password */
  2496. -    /* Other fields / flags may be added later */
  2497. -};
  2498. -
  2499. -/* Return a smb_passwd struct given a user name, 0 if fails. */
  2500. -struct smb_passwd *get_smbpwnam(char *user);
  2501. -
  2502. -#ifndef uchar
  2503. -#define uchar unsigned char
  2504. -#endif
  2505. -
  2506. -/* SMB Encryption functions. */
  2507. -void str_to_key(unsigned char *str,unsigned char *key);
  2508. -void E_P16(uchar *p14,uchar *p16);
  2509. -void E_P24(unsigned char *p21, unsigned char *c8, unsigned char *p24);
  2510. -void E_md4hash(uchar *passwd,uchar *p16);
  2511. -void SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
  2512. -void SMB_nt_encrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
  2513. -
  2514. -/* Password file lock/unlock routines */
  2515. -int pw_file_lock(char *name, int type, int secs);
  2516. -int pw_file_unlock(int fd);
  2517. -#endif
  2518. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/status.c samba-1.9.16alpha10/source/status.c
  2519. --- samba-1.9.16alpha9/source/status.c    Wed Jun  5 01:16:29 1996
  2520. +++ samba-1.9.16alpha10/source/status.c    Mon Jun 10 15:19:03 1996
  2521. @@ -28,7 +28,6 @@
  2522.  #endif
  2523.  
  2524.  #include "includes.h"
  2525. -#include "loadparm.h"
  2526.  
  2527.  struct connect_record crec;
  2528.  extern int DEBUGLEVEL;
  2529. @@ -39,10 +38,6 @@
  2530.  int            Ucrit_pid[100];  /* Ugly !!! */        /* added by OH */
  2531.  int            Ucrit_MaxPid=0;                        /* added by OH */
  2532.  unsigned int   Ucrit_IsActive = 0;                    /* added by OH */
  2533. -void           Ucrit_addUsername(pstring username);   /* added by OH */
  2534. -unsigned int   Ucrit_checkUsername(pstring username); /* added by OH */
  2535. -void           Ucrit_addPid(int pid);                 /* added by OH */
  2536. -unsigned int   Ucrit_checkPid(int pid);               /* added by OH */
  2537.  
  2538.   int main(int argc, char *argv[])
  2539.  {
  2540. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/testparm.c samba-1.9.16alpha10/source/testparm.c
  2541. --- samba-1.9.16alpha9/source/testparm.c    Wed Jun  5 01:16:29 1996
  2542. +++ samba-1.9.16alpha10/source/testparm.c    Mon Jun 10 15:19:03 1996
  2543. @@ -34,8 +34,6 @@
  2544.  
  2545.  #include "includes.h"
  2546.  #include "smb.h"
  2547. -#include "params.h"
  2548. -#include "loadparm.h"
  2549.  
  2550.  /* these live in util.c */
  2551.  extern FILE *dbf;
  2552. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/testprns.c samba-1.9.16alpha10/source/testprns.c
  2553. --- samba-1.9.16alpha9/source/testprns.c    Sat Jun  1 01:15:13 1996
  2554. +++ samba-1.9.16alpha10/source/testprns.c    Mon Jun 10 15:19:03 1996
  2555. @@ -33,7 +33,6 @@
  2556.  
  2557.  #include "includes.h"
  2558.  #include "smb.h"
  2559. -#include "pcap.h"
  2560.  
  2561.  /* these live in util.c */
  2562.  extern FILE *dbf;
  2563. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/trans2.c samba-1.9.16alpha10/source/trans2.c
  2564. --- samba-1.9.16alpha9/source/trans2.c    Thu Jun  6 01:44:18 1996
  2565. +++ samba-1.9.16alpha10/source/trans2.c    Mon Jun 10 15:19:03 1996
  2566. @@ -22,7 +22,6 @@
  2567.  */
  2568.  
  2569.  #include "includes.h"
  2570. -#include "loadparm.h"
  2571.  #include "trans2.h"
  2572.  
  2573.  extern int DEBUGLEVEL;
  2574. @@ -1555,10 +1554,8 @@
  2575.  
  2576.        while( num_data_sofar < total_data || num_params_sofar < total_params)
  2577.      {
  2578. -      receive_smb(Client,inbuf, 0);
  2579. -      
  2580. -      /* Ensure this is still a trans2 packet (sanity check) */
  2581. -      if(CVAL(inbuf, smb_com) != SMBtranss2)
  2582. +      if(!receive_smb(Client,inbuf, SMB_SECONDARY_WAIT*1000) ||
  2583. +         CVAL(inbuf, smb_com) != SMBtranss2)
  2584.          {
  2585.            outsize = set_message(outbuf,0,0,True);
  2586.            DEBUG(2,("Invalid secondary trans2 packet\n"));
  2587. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/ufc.c samba-1.9.16alpha10/source/ufc.c
  2588. --- samba-1.9.16alpha9/source/ufc.c    Wed Jun  5 01:16:29 1996
  2589. +++ samba-1.9.16alpha10/source/ufc.c    Mon Jun 10 15:19:04 1996
  2590. @@ -656,8 +656,6 @@
  2591.      return outbuf;
  2592.    }
  2593.  
  2594. -ufc_long *_ufc_doit();
  2595. -
  2596.  /* 
  2597.   * UNIX crypt function
  2598.   */
  2599. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/uid.c samba-1.9.16alpha10/source/uid.c
  2600. --- samba-1.9.16alpha9/source/uid.c    Wed Jun  5 01:16:29 1996
  2601. +++ samba-1.9.16alpha10/source/uid.c    Mon Jun 10 15:19:04 1996
  2602. @@ -20,7 +20,6 @@
  2603.  */
  2604.  
  2605.  #include "includes.h"
  2606. -#include "loadparm.h"
  2607.  
  2608.  extern int DEBUGLEVEL;
  2609.  
  2610. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/username.c samba-1.9.16alpha10/source/username.c
  2611. --- samba-1.9.16alpha9/source/username.c    Sat May  4 17:50:25 1996
  2612. +++ samba-1.9.16alpha10/source/username.c    Mon Jun 10 15:19:04 1996
  2613. @@ -20,7 +20,6 @@
  2614.  */
  2615.  
  2616.  #include "includes.h"
  2617. -#include "loadparm.h"
  2618.  extern int DEBUGLEVEL;
  2619.  
  2620.  
  2621. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/util.c samba-1.9.16alpha10/source/util.c
  2622. --- samba-1.9.16alpha9/source/util.c    Fri Jun  7 15:36:55 1996
  2623. +++ samba-1.9.16alpha10/source/util.c    Mon Jun 10 15:19:05 1996
  2624. @@ -20,7 +20,6 @@
  2625.  */
  2626.  
  2627.  #include "includes.h"
  2628. -#include "loadparm.h"
  2629.  
  2630.  pstring scope = "";
  2631.  
  2632. @@ -267,136 +266,6 @@
  2633.  }
  2634.  
  2635.  /****************************************************************************
  2636. -routine to do file locking
  2637. -****************************************************************************/
  2638. -BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type)
  2639. -{
  2640. -#if HAVE_FCNTL_LOCK
  2641. -  struct flock lock;
  2642. -  int ret;
  2643. -
  2644. -#if 1
  2645. -  uint32 mask = 0xC0000000;
  2646. -
  2647. -  /* make sure the count is reasonable, we might kill the lockd otherwise */
  2648. -  count &= ~mask;
  2649. -
  2650. -  /* the offset is often strange - remove 2 of its bits if either of
  2651. -     the top two bits are set. Shift the top ones by two bits. This
  2652. -     still allows OLE2 apps to operate, but should stop lockd from
  2653. -     dieing */
  2654. -  if ((offset & mask) != 0)
  2655. -    offset = (offset & ~mask) | ((offset & mask) >> 2);
  2656. -#else
  2657. -  unsigned long mask = ((unsigned)1<<31);
  2658. -
  2659. -  /* interpret negative counts as large numbers */
  2660. -  if (count < 0)
  2661. -    count &= ~mask;
  2662. -
  2663. -  /* no negative offsets */
  2664. -  offset &= ~mask;
  2665. -
  2666. -  /* count + offset must be in range */
  2667. -  while ((offset < 0 || (offset + count < 0)) && mask)
  2668. -    {
  2669. -      offset &= ~mask;
  2670. -      mask = mask >> 1;
  2671. -    }
  2672. -#endif
  2673. -
  2674. -
  2675. -  DEBUG(5,("fcntl_lock %d %d %d %d %d\n",fd,op,(int)offset,(int)count,type));
  2676. -
  2677. -  lock.l_type = type;
  2678. -  lock.l_whence = SEEK_SET;
  2679. -  lock.l_start = (int)offset;
  2680. -  lock.l_len = (int)count;
  2681. -  lock.l_pid = 0;
  2682. -
  2683. -  errno = 0;
  2684. -
  2685. -  ret = fcntl(fd,op,&lock);
  2686. -
  2687. -  if (errno != 0)
  2688. -    DEBUG(3,("fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
  2689. -
  2690. -  /* a lock query */
  2691. -  if (op == F_GETLK)
  2692. -    {
  2693. -      if ((ret != -1) &&
  2694. -      (lock.l_type != F_UNLCK) && 
  2695. -      (lock.l_pid != 0) && 
  2696. -      (lock.l_pid != getpid()))
  2697. -    {
  2698. -      DEBUG(3,("fd %d is locked by pid %d\n",fd,lock.l_pid));
  2699. -      return(True);
  2700. -    }
  2701. -
  2702. -      /* it must be not locked or locked by me */
  2703. -      return(False);
  2704. -    }
  2705. -
  2706. -  /* a lock set or unset */
  2707. -  if (ret == -1)
  2708. -    {
  2709. -      DEBUG(3,("lock failed at offset %d count %d op %d type %d (%s)\n",
  2710. -           offset,count,op,type,strerror(errno)));
  2711. -
  2712. -      /* perhaps it doesn't support this sort of locking?? */
  2713. -      if (errno == EINVAL)
  2714. -    {
  2715. -      DEBUG(3,("locking not supported? returning True\n"));
  2716. -      return(True);
  2717. -    }
  2718. -
  2719. -      return(False);
  2720. -    }
  2721. -
  2722. -  /* everything went OK */
  2723. -  DEBUG(5,("Lock call successful\n"));
  2724. -
  2725. -  return(True);
  2726. -#else
  2727. -  return(False);
  2728. -#endif
  2729. -}
  2730. -
  2731. -/*******************************************************************
  2732. -lock a file - returning a open file descriptor or -1 on failure
  2733. -The timeout is in seconds. 0 means no timeout
  2734. -********************************************************************/
  2735. -int file_lock(char *name,int timeout)
  2736. -{  
  2737. -  int fd = open(name,O_RDWR|O_CREAT,0666);
  2738. -  time_t t=0;
  2739. -  if (fd < 0) return(-1);
  2740. -
  2741. -#if HAVE_FCNTL_LOCK
  2742. -  if (timeout) t = time(NULL);
  2743. -  while (!timeout || (time(NULL)-t < timeout)) {
  2744. -    if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)) return(fd);    
  2745. -    msleep(LOCK_RETRY_TIMEOUT);
  2746. -  }
  2747. -  return(-1);
  2748. -#else
  2749. -  return(fd);
  2750. -#endif
  2751. -}
  2752. -
  2753. -/*******************************************************************
  2754. -unlock a file locked by file_lock
  2755. -********************************************************************/
  2756. -void file_unlock(int fd)
  2757. -{
  2758. -  if (fd<0) return;
  2759. -#if HAVE_FCNTL_LOCK
  2760. -  fcntl_lock(fd,F_SETLK,0,1,F_UNLCK);
  2761. -#endif
  2762. -  close(fd);
  2763. -}
  2764. -
  2765. -/****************************************************************************
  2766.  determine if a file descriptor is in fact a socket
  2767.  ****************************************************************************/
  2768.  BOOL is_a_socket(int fd)
  2769. @@ -2210,7 +2079,7 @@
  2770.  
  2771.        if (msg_type == 0x85) 
  2772.      {
  2773. -      DEBUG(5,( "Got keepalive packet\n"));
  2774. +      DEBUG(5,("Got keepalive packet\n"));
  2775.        ok = False;
  2776.      }
  2777.      }
  2778. @@ -2228,8 +2097,7 @@
  2779.  ****************************************************************************/
  2780.  BOOL receive_smb(int fd,char *buffer,int timeout)
  2781.  {
  2782. -  int len;
  2783. -  BOOL ok;
  2784. +  int len,ret;
  2785.  
  2786.    bzero(buffer,smb_size + 100);
  2787.  
  2788. @@ -2238,18 +2106,16 @@
  2789.      return(False);
  2790.  
  2791.    if (len > BUFFER_SIZE) {
  2792. -    DEBUG(0,("Invalid packet length! (%d bytes)\n",len));
  2793. +    DEBUG(0,("Invalid packet length! (%d bytes).\n",len));
  2794.      if (len > BUFFER_SIZE + (SAFETY_MARGIN/2))
  2795.        exit(1);
  2796.    }
  2797.  
  2798. -  ok = (read_data(fd,buffer+4,len) == len);
  2799. -
  2800. -  if (!ok)
  2801. -    {
  2802. -      close_sockets();
  2803. -      exit(1);
  2804. -    }
  2805. +  ret = read_data(fd,buffer+4,len);
  2806. +  if (ret != len) {
  2807. +    DEBUG(0,("ERROR: Invalid SMB length. Expected %d got %d\n",len,ret));
  2808. +    return False;
  2809. +  }
  2810.  
  2811.    return(True);
  2812.  }
  2813. @@ -2915,39 +2781,6 @@
  2814.    exit(2);
  2815.  }
  2816.  
  2817. -
  2818. -#ifdef REPLACE_STRLEN
  2819. -/****************************************************************************
  2820. -a replacement strlen() that returns int for solaris
  2821. -****************************************************************************/
  2822. - int Strlen(char *s)
  2823. -{
  2824. -  int ret=0;
  2825. -  if (!s) return(0);
  2826. -  while (*s++) ret++;
  2827. -  return(ret);
  2828. -}
  2829. -#endif
  2830. -
  2831. -
  2832. -#ifdef NO_FTRUNCATE
  2833. - /*******************************************************************
  2834. -ftruncate for operating systems that don't have it
  2835. -********************************************************************/
  2836. - int ftruncate(int f,long l)
  2837. -{
  2838. -      struct  flock   fl;
  2839. -
  2840. -      fl.l_whence = 0;
  2841. -      fl.l_len = 0;
  2842. -      fl.l_start = l;
  2843. -      fl.l_type = F_WRLCK;
  2844. -      return fcntl(f, F_FREESP, &fl);
  2845. -}
  2846. -#endif
  2847. -
  2848. -
  2849. -
  2850.  /****************************************************************************
  2851.  get my own name and IP
  2852.  ****************************************************************************/
  2853. @@ -3448,270 +3281,6 @@
  2854.  
  2855.    return(dname);
  2856.  }
  2857. -
  2858. -
  2859. -
  2860. -#if (defined(SecureWare) && defined(SCO))
  2861. -/* This is needed due to needing the nap() function but we don't want
  2862. -   to include the Xenix libraries since that will break other things...
  2863. -   BTW: system call # 0x0c28 is the same as calling nap() */
  2864. -long nap(long milliseconds) {
  2865. -  return syscall(0x0c28, milliseconds);
  2866. -}
  2867. -#endif
  2868. -
  2869. -#ifdef NO_INITGROUPS
  2870. -#include <sys/types.h>
  2871. -#include <limits.h>
  2872. -#include <grp.h>
  2873. -
  2874. -#ifndef NULL
  2875. -#define NULL (void *)0
  2876. -#endif
  2877. -
  2878. -/****************************************************************************
  2879. - some systems don't have an initgroups call 
  2880. -****************************************************************************/
  2881. - int initgroups(char *name,gid_t id)
  2882. -{
  2883. -#ifdef NO_SETGROUPS
  2884. -  /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
  2885. -  return(0);
  2886. -#else
  2887. -  gid_t  grouplst[NGROUPS_MAX];
  2888. -  int    i,j;
  2889. -  struct group *g;
  2890. -  char   *gr;
  2891. -
  2892. -  grouplst[0] = id;
  2893. -  i = 1;
  2894. -  while (i < NGROUPS_MAX && 
  2895. -     ((g = (struct group *)getgrent()) != (struct group *)NULL)) 
  2896. -    {
  2897. -      if (g->gr_gid == id)
  2898. -    continue;
  2899. -      j = 0;
  2900. -      gr = g->gr_mem[0];
  2901. -      while (gr && (*gr != (char)NULL)) {
  2902. -    if (strcmp(name,gr) == 0) {
  2903. -      grouplst[i] = g->gr_gid;
  2904. -      i++;
  2905. -      gr = (char *)NULL;
  2906. -      break;
  2907. -    }
  2908. -    gr = g->gr_mem[++j];
  2909. -      }
  2910. -    }
  2911. -  endgrent();
  2912. -  return(setgroups(i,grouplst));
  2913. -#endif
  2914. -}
  2915. -#endif
  2916. -
  2917. -
  2918. -#if WRAP_MALLOC
  2919. -
  2920. -/* undo the wrapping temporarily */
  2921. -#undef malloc
  2922. -#undef realloc
  2923. -#undef free
  2924. -
  2925. -/****************************************************************************
  2926. -wrapper for malloc() to catch memory errors
  2927. -****************************************************************************/
  2928. -void *malloc_wrapped(int size,char *file,int line)
  2929. -{
  2930. -#ifdef xx_old_malloc
  2931. -  void *res = xx_old_malloc(size);
  2932. -#else
  2933. -  void *res = malloc(size);
  2934. -#endif
  2935. -  DEBUG(3,("Malloc called from %s(%d) with size=%d gave ptr=0x%X\n",
  2936. -    file,line,
  2937. -    size,(unsigned int)res));
  2938. -  return(res);
  2939. -}
  2940. -
  2941. -/****************************************************************************
  2942. -wrapper for realloc() to catch memory errors
  2943. -****************************************************************************/
  2944. -void *realloc_wrapped(void *ptr,int size,char *file,int line)
  2945. -{
  2946. -#ifdef xx_old_realloc
  2947. -  void *res = xx_old_realloc(ptr,size);
  2948. -#else
  2949. -  void *res = realloc(ptr,size);
  2950. -#endif
  2951. -  DEBUG(3,("Realloc\n"));
  2952. -  DEBUG(3,("free called from %s(%d) with ptr=0x%X\n",
  2953. -    file,line,
  2954. -    (unsigned int)ptr));
  2955. -  DEBUG(3,("Malloc called from %s(%d) with size=%d gave ptr=0x%X\n",
  2956. -    file,line,
  2957. -    size,(unsigned int)res));
  2958. -  return(res);
  2959. -}
  2960. -
  2961. -/****************************************************************************
  2962. -wrapper for free() to catch memory errors
  2963. -****************************************************************************/
  2964. -void free_wrapped(void *ptr,char *file,int line)
  2965. -{
  2966. -#ifdef xx_old_free
  2967. -  xx_old_free(ptr);
  2968. -#else
  2969. -  free(ptr);
  2970. -#endif
  2971. -  DEBUG(3,("free called from %s(%d) with ptr=0x%X\n",
  2972. -    file,line,(unsigned int)ptr));
  2973. -  return;
  2974. -}
  2975. -
  2976. -/* and re-do the define for spots lower in this file */
  2977. -#define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
  2978. -#define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
  2979. -#define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
  2980. -
  2981. -#endif
  2982. -
  2983. -#ifdef REPLACE_STRSTR
  2984. -/****************************************************************************
  2985. -Mips version of strstr doesn't seem to work correctly.
  2986. -There is a #define in includes.h to redirect calls to this function.
  2987. -****************************************************************************/
  2988. -char *Strstr(char *s, char *p)
  2989. -{
  2990. -    int len = strlen(p);
  2991. -
  2992. -    while ( *s != '\0' ) {
  2993. -        if ( strncmp(s, p, len) == 0 )
  2994. -        return s;
  2995. -        s++;
  2996. -    }
  2997. -
  2998. -    return NULL;
  2999. -}
  3000. -#endif /* REPLACE_STRSTR */
  3001. -
  3002. -
  3003. -#ifdef REPLACE_MKTIME
  3004. -/*******************************************************************
  3005. -a mktime() replacement for those who don't have it - contributed by 
  3006. -C.A. Lademann <cal@zls.com>
  3007. -********************************************************************/
  3008. -#define  MINUTE  60
  3009. -#define  HOUR    60*MINUTE
  3010. -#define  DAY             24*HOUR
  3011. -#define  YEAR    365*DAY
  3012. -time_t Mktime(struct tm      *t)
  3013. -{
  3014. -  struct tm       *u;
  3015. -  time_t  epoch = 0;
  3016. -  int             mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
  3017. -  y, m, i;
  3018. -
  3019. -  if(t->tm_year < 70)
  3020. -    return((time_t)-1);
  3021. -
  3022. -  epoch = (t->tm_year - 70) * YEAR + 
  3023. -    (t->tm_year / 4 - 70 / 4 - t->tm_year / 100) * DAY;
  3024. -
  3025. -  y = t->tm_year;
  3026. -  m = 0;
  3027. -
  3028. -  for(i = 0; i < t->tm_mon; i++) {
  3029. -    epoch += mon [m] * DAY;
  3030. -    if(m == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))
  3031. -      epoch += DAY;
  3032. -    
  3033. -    if(++m > 11) {
  3034. -      m = 0;
  3035. -      y++;
  3036. -    }
  3037. -  }
  3038. -
  3039. -  epoch += (t->tm_mday - 1) * DAY;
  3040. -  epoch += t->tm_hour * HOUR + t->tm_min * MINUTE + t->tm_sec;
  3041. -  
  3042. -  if((u = localtime(&epoch)) != NULL) {
  3043. -    t->tm_sec = u->tm_sec;
  3044. -    t->tm_min = u->tm_min;
  3045. -    t->tm_hour = u->tm_hour;
  3046. -    t->tm_mday = u->tm_mday;
  3047. -    t->tm_mon = u->tm_mon;
  3048. -    t->tm_year = u->tm_year;
  3049. -    t->tm_wday = u->tm_wday;
  3050. -    t->tm_yday = u->tm_yday;
  3051. -    t->tm_isdst = u->tm_isdst;
  3052. -#ifndef NO_TM_NAME
  3053. -    memcpy(t->tm_name, u->tm_name, LTZNMAX);
  3054. -#endif
  3055. -  }
  3056. -
  3057. -  return(epoch);
  3058. -}
  3059. -#endif /* REPLACE_MKTIME */
  3060. -
  3061. -
  3062. -
  3063. -#ifdef REPLACE_RENAME
  3064. -/* Rename a file. (from libiberty in GNU binutils)  */
  3065. - int rename (zfrom, zto)
  3066. -     const char *zfrom;
  3067. -     const char *zto;
  3068. -{
  3069. -  if (link (zfrom, zto) < 0)
  3070. -    {
  3071. -      if (errno != EEXIST)
  3072. -    return -1;
  3073. -      if (unlink (zto) < 0
  3074. -      || link (zfrom, zto) < 0)
  3075. -    return -1;
  3076. -    }
  3077. -  return unlink (zfrom);
  3078. -}
  3079. -#endif
  3080. -
  3081. -
  3082. -#ifdef REPLACE_INNETGR
  3083. -/*
  3084. - * Search for a match in a netgroup. This replaces it on broken systems.
  3085. - */
  3086. -int InNetGr(char *group,char *host,char *user,char *dom)
  3087. -{
  3088. -  char *hst, *usr, *dm;
  3089. -  
  3090. -  setnetgrent(group);
  3091. -  while (getnetgrent(&hst, &usr, &dm))
  3092. -    if (((host == 0) || (hst == 0) || !strcmp(host, hst)) &&
  3093. -    ((user == 0) || (usr == 0) || !strcmp(user, usr)) &&
  3094. -    ((dom == 0) || (dm == 0) || !strcmp(dom, dm))) {
  3095. -      endnetgrent();
  3096. -      return (1);
  3097. -    }
  3098. -  endnetgrent();
  3099. -  return (0);
  3100. -}
  3101. -#endif
  3102. -
  3103. -
  3104. -#if WRAP_MEMCPY
  3105. -#undef memcpy
  3106. -/*******************************************************************
  3107. -a wrapper around memcpy for diagnostic purposes
  3108. -********************************************************************/
  3109. -void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line)
  3110. -{
  3111. -  if (l>64 && (((int)d)%4) != (((int)s)%4))
  3112. -    DEBUG(4,("Misaligned memcpy(0x%X,0x%X,%d) at %s(%d)\n",d,s,l,fname,line));
  3113. -#ifdef xx_old_memcpy  
  3114. -  return(xx_old_memcpy(d,s,l));
  3115. -#else
  3116. -  return(memcpy(d,s,l));
  3117. -#endif
  3118. -}
  3119. -#define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
  3120. -#endif
  3121.  
  3122.  
  3123.  
  3124. diff -u -r --new-file --exclude=CVS samba-1.9.16alpha9/source/version.h samba-1.9.16alpha10/source/version.h
  3125. --- samba-1.9.16alpha9/source/version.h    Sat Jun  8 15:38:39 1996
  3126. +++ samba-1.9.16alpha10/source/version.h    Mon Jun 10 15:19:48 1996
  3127. @@ -1 +1 @@
  3128. -#define VERSION "1.9.16alpha9"
  3129. +#define VERSION "1.9.16alpha10"
  3130.